Skip to content

Commit 40bf588

Browse files
committed
Make event queueing non-async
Make sure all events are queued before handling the next line
1 parent 93c323b commit 40bf588

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- Handle 'a' vs 'an' in drinks plugin
2020
- Apply rate limiting to regex hooks
2121
- Ensure event order is deterministic
22+
- Make event queueing happen non-async
2223
### Fixed
2324
- Ensure event order is deterministic
2425
- Fix matching exception in horoscope test

cloudbot/bot.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def load_clients(self):
307307
scanner = Scanner(bot=self)
308308
scanner.scan(clients, categories=["cloudbot.client"])
309309

310-
async def process(self, event):
310+
def process(self, event):
311311
"""
312312
:type event: Event
313313
"""
@@ -418,8 +418,5 @@ def add_hook(hook, _event):
418418

419419
tasks.sort(key=lambda t: t[0].priority)
420420

421-
# Run the tasks
422-
await asyncio.gather(*[
423-
asyncio.ensure_future(self.plugin_manager.launch(hook, _event))
424-
for hook, _event in tasks
425-
], loop=self.loop)
421+
for _hook, _event in tasks:
422+
async_util.wrap_future(self.plugin_manager.launch(_hook, _event))

cloudbot/clients/irc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,8 @@ def data_received(self, data):
525525
self.conn.describe_server(),
526526
)
527527
else:
528-
# handle the message, async
529-
async_util.wrap_future(self.bot.process(event), loop=self.loop)
528+
# handle the message
529+
self.bot.process(event)
530530

531531
def parse_line(self, line: str) -> Event:
532532
message = Message.parse(line)

0 commit comments

Comments
 (0)