Josh VanderLinden avatar Josh VanderLinden committed 9e2b442

Requesting status update if we haven't had one recently

Comments (0)

Files changed (2)

 # Maintainer: Josh VanderLinden <>
 pkgdesc="Deliver message notifications to remote machines"
 buffer with unseen messages or when you type into such a buffer.
-from itertools import count
 from threading import Thread, Event
 import atexit
 import os
 import re
 import sh
 import site
+import time
 import zmq
         def receive(ev):
   'About to receive messages')
+            last_update = 0
             p = zmq.Poller()
             p.register(SUB, zmq.POLLIN)
-            ticks = count()
-            request_status()
                 while not ev.is_set():
+                    # request a status update if we haven't received anything
+                    # recently
+                    if time.time() - last_update >= REFRESH_INTERVAL:
+                        request_status()
                         socks = dict(p.poll(1000))
                         if SUB in socks:
+                            last_update = time.time()
-                    n = next(ticks)
-                    if n >= REFRESH_INTERVAL:
-                        request_status()
-                        ticks = count()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.