Submitter | Jun Wu |
---|---|
Date | May 6, 2017, 11:39 p.m. |
Message ID | <ba6bc72d245d779c8951.1494113956@x1c> |
Download | mbox | patch |
Permalink | /patch/20495/ |
State | Accepted |
Headers | show |
Comments
On Sat, 6 May 2017 16:39:16 -0700, Jun Wu wrote: > # HG changeset patch > # User Jun Wu <quark@fb.com> > # Date 1493527390 25200 > # Sat Apr 29 21:43:10 2017 -0700 > # Node ID ba6bc72d245d779c8951d50eddca1bea9b1b802a > # Parent 1adb2037f0d1f8dc2b84b3804a763ec4c70c00ac > # Available At https://bitbucket.org/quark-zju/hg-draft > # hg pull https://bitbucket.org/quark-zju/hg-draft -r ba6bc72d245d > commandserver: add a heartbeat method to servicehandler > > This allows chg to do extra things periodically, like checking if there are > repos needed to be preloaded. > > diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py > --- a/mercurial/commandserver.py > +++ b/mercurial/commandserver.py > @@ -417,4 +417,8 @@ class unixservicehandler(object): > os.unlink(address) > > + def heartbeat(self): > + """Called periodically before fork""" > + pass > + > def shouldexit(self): > """True if server should shut down; checked per pollinterval""" > @@ -486,4 +490,6 @@ class unixforkingservice(object): > self._unlinksocket() > exiting = True > + else: > + h.heartbeat() Looks okay, but this breaks chg.
Patch
diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -417,4 +417,8 @@ class unixservicehandler(object): os.unlink(address) + def heartbeat(self): + """Called periodically before fork""" + pass + def shouldexit(self): """True if server should shut down; checked per pollinterval""" @@ -486,4 +490,6 @@ class unixforkingservice(object): self._unlinksocket() exiting = True + else: + h.heartbeat() try: ready = select.select([self._sock], [], [], h.pollinterval)[0]