mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 08:21:32 +00:00
Avoid waiting before first queued message
This commit is contained in:
parent
15b4ab62e5
commit
0518716df8
@ -17,8 +17,8 @@ class MessageQueueHandler:
|
||||
for message in iter(self._queue.get, None):
|
||||
wpm = message['wpm'] if 'wpm' in message else self.wpm
|
||||
cps = 5 * wpm / 60
|
||||
sleep(len(message['message']) / cps)
|
||||
self.connector.send_message(message)
|
||||
sleep(len(message['message']) / cps)
|
||||
|
||||
def handle_event(self, message, _):
|
||||
for unpacked in self._generate_messages_from_queue(message):
|
||||
|
@ -60,7 +60,7 @@ def test_message_order(handler, queue):
|
||||
def test_wpm(handler, queue):
|
||||
handler.wpm = 10000
|
||||
handler.connector.raise_event(queue)
|
||||
assert not handler.connector.messages
|
||||
assert len(handler.connector.messages) == 1
|
||||
handler.wpm = 100000000
|
||||
handler.connector.raise_event(queue)
|
||||
sleep(0.25)
|
||||
|
Loading…
Reference in New Issue
Block a user