Skip to content

Commit

Permalink
Let message queue service declare standard exchange upon initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
cleborys committed Jun 29, 2021
1 parent 2be1b80 commit f7db8d2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions server/broadcast_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ def __init__(
self.player_service = player_service

async def initialize(self):
await self.message_queue_service.declare_exchange(
config.MQ_EXCHANGE_NAME
)

# Using a lazy interval timer so that the intervals can be changed
# without restarting the server.
self._broadcast_dirties_timer = LazyIntervalTimer(
Expand Down
2 changes: 0 additions & 2 deletions server/game_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ async def initialize(self) -> None:
"*/10 * * * *", func=self.update_data
)

await self._message_queue_service.declare_exchange(config.MQ_EXCHANGE_NAME)

async def initialise_game_counter(self):
async with self._db.acquire() as conn:
# InnoDB, unusually, doesn't allow insertion of values greater than the next expected
Expand Down
2 changes: 2 additions & 0 deletions server/message_queue_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ async def initialize(self) -> None:
return
self._is_ready = True

await self._declare_exchange(config.MQ_EXCHANGE_NAME, ExchangeType.TOPIC)

async def _connect(self) -> None:
try:
self._connection = await aio_pika.connect_robust(
Expand Down

0 comments on commit f7db8d2

Please sign in to comment.