Mercurial > hg
changeset 10494:08064db9f005 stable
inotify/inserve: implement --timeout-idle option (issue885)
hg inserve was ignoring and miscomputing the --timeout-idle option (seconds
vs. minutes).
Thanks to Jesse Glick for the bugreport and the initial patch.
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 17 Feb 2010 20:44:49 +0100 |
parents | 283f3b413f19 |
children | 2c2d2f1354b4 |
files | hgext/inotify/linuxserver.py hgext/inotify/server.py |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/inotify/linuxserver.py Wed Feb 17 20:30:57 2010 +0100 +++ b/hgext/inotify/linuxserver.py Wed Feb 17 20:44:49 2010 +0100 @@ -397,7 +397,7 @@ self.register(timeout=timeout) def handle_timeout(self): - pass + raise server.TimeoutException def handle_pollevents(self, events): for e in events:
--- a/hgext/inotify/server.py Wed Feb 17 20:30:57 2010 +0100 +++ b/hgext/inotify/server.py Wed Feb 17 20:44:49 2010 +0100 @@ -19,6 +19,8 @@ class AlreadyStartedException(Exception): pass +class TimeoutException(Exception): + pass def join(a, b): if a: @@ -444,9 +446,11 @@ master = _server.master def start(ui, dirstate, root, opts): - timeout = opts.get('timeout') + timeout = opts.get('idle_timeout') if timeout: - timeout = float(timeout) * 1e3 + timeout = float(timeout) * 60000 + else: + timeout = None class service(object): def init(self): @@ -457,7 +461,10 @@ def run(self): try: - self.master.run() + try: + self.master.run() + except TimeoutException: + pass finally: self.master.shutdown()