Skip to content

Commit

Permalink
Make exchange name used by game_service configurable (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
cleborys authored Sep 21, 2020
1 parent a525255 commit aecbf8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self):
self.MQ_SERVER = "127.0.0.1"
self.MQ_PORT = 5672
self.MQ_VHOST = "/faf-lobby"
self.MQ_EXCHANGE_NAME = "faf-rabbitmq"

self.WWW_URL = "https://www.faforever.com"
self.CONTENT_URL = "http://content.faforever.com"
Expand Down
6 changes: 4 additions & 2 deletions server/game_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import aiocron

from server.config import config

from . import metrics
from .core import Service
from .db import FAFDatabase
Expand Down Expand Up @@ -60,7 +62,7 @@ async def initialize(self) -> None:
"*/10 * * * *", func=self.update_data
)

await self._message_queue_service.declare_exchange("faf-rabbitmq")
await self._message_queue_service.declare_exchange(config.MQ_EXCHANGE_NAME)

async def initialise_game_counter(self):
async with self._db.acquire() as conn:
Expand Down Expand Up @@ -227,7 +229,7 @@ def __contains__(self, item):
async def publish_game_results(self, game_results: EndedGameInfo):
result_dict = game_results.to_dict()
await self._message_queue_service.publish(
"faf-rabbitmq",
config.MQ_EXCHANGE_NAME,
"success.gameResults.create",
result_dict,
)
Expand Down

0 comments on commit aecbf8f

Please sign in to comment.