Skip to content

Commit c7c6890

Browse files
committed
Make event queueing non-async
Make sure all events are queued before handling the next line
1 parent fe61483 commit c7c6890

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
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- Handle 'a' vs 'an' in drinks plugin
1818
- Apply rate limiting to regex hooks
1919
- Ensure event order is deterministic
20+
- Make event queueing happen non-async
2021
### Fixed
2122
- Ensure event order is deterministic
2223
- Fix matching exception in horoscope test

cloudbot/bot.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def load_clients(self):
296296
scanner = Scanner(bot=self)
297297
scanner.scan(clients, categories=['cloudbot.client'])
298298

299-
async def process(self, event):
299+
def process(self, event):
300300
"""
301301
:type event: Event
302302
"""
@@ -397,8 +397,5 @@ def add_hook(hook, _event):
397397

398398
tasks.sort(key=lambda t: t[0].priority)
399399

400-
# Run the tasks
401-
await asyncio.gather(*[
402-
asyncio.ensure_future(self.plugin_manager.launch(hook, _event))
403-
for hook, _event in tasks
404-
], loop=self.loop)
400+
for _hook, _event in tasks:
401+
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
@@ -464,8 +464,8 @@ def data_received(self, data):
464464
self.conn.name, line, self.conn.describe_server()
465465
)
466466
else:
467-
# handle the message, async
468-
async_util.wrap_future(self.bot.process(event), loop=self.loop)
467+
# handle the message
468+
self.bot.process(event)
469469

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

0 commit comments

Comments
 (0)