aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 5cf8990..9847f8d 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -287,6 +287,8 @@ class EventRouter(object):
self.shutting_down = False
self.recording = False
self.recording_path = "/tmp"
+ self.handle_next_hook = None
+ self.handle_next_hook_interval = -1
def record(self):
"""
@@ -490,6 +492,16 @@ class EventRouter(object):
via callback to drain events from the queue. It also attaches
useful metadata and context to events as they are processed.
"""
+ wanted_interval = 100
+ if len(self.slow_queue) > 0 or len(self.queue) > 0:
+ wanted_interval = 10
+ if self.handle_next_hook is None or wanted_interval != self.handle_next_hook_interval:
+ if self.handle_next_hook:
+ w.unhook(self.handle_next_hook)
+ self.handle_next_hook = w.hook_timer(wanted_interval, 0, 0, "handle_next", "")
+ self.handle_next_hook_interval = wanted_interval
+
+
if len(self.slow_queue) > 0 and ((self.slow_queue_timer + 1) < time.time()):
# for q in self.slow_queue[0]:
dbg("from slow queue", 0)
@@ -4117,5 +4129,4 @@ if __name__ == "__main__":
if config.record_events:
EVENTROUTER.record()
EVENTROUTER.handle_next()
- w.hook_timer(10, 0, 0, "handle_next", "")
# END attach to the weechat hooks we need