Skip to content

Commit e7460ae

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

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
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Change user lookup logic in last.fm plugin
1515
- Refactor minecraft_ping plugin for updated mcstatus library
1616
- Expand youtube.py error information
17+
- Make event queueing happen non-async
1718
### Fixed
1819
- Ensure event order is deterministic
1920
- 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)