Skip to content

Commit

Permalink
Only send OCS notifications when enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkneipp committed Feb 13, 2024
1 parent 42a48a3 commit 499d155
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions services/georedService.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, redisHost: str='127.0.0.1', redisPort: int=6379):
self.georedPeers = self.config.get('geored', {}).get('endpoints', [])
self.webhookPeers = self.config.get('webhooks', {}).get('endpoints', [])
self.ocsPeers = self.config.get('ocs', {}).get('endpoints', [])
self.ocsNotificationsEnabled = self.config.get('ocs', {}).get('enabled', False)
self.benchmarking = self.config.get('hss').get('enable_benchmarking', False)
self.hostname = socket.gethostname()

Expand Down Expand Up @@ -378,10 +379,11 @@ async def handleWebhookQueue(self):
socketSession = aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False))
async with socketSession as session:
if webhookType == 'ocs':
for remotePeer in self.ocsPeers:
await(self.logTool.logAsync(service='Geored', level='debug', message=f"[Geored] [handleWebhookQueue] Sending OCS Notification to: {remotePeer}"))
webhookTasks.append(self.sendWebhook(asyncSession=session, url=remotePeer, operation=webhookOperation, body=webhookBody, headers=webhookHeaders))
await asyncio.gather(*webhookTasks)
if self.ocsNotificationsEnabled:
for remotePeer in self.ocsPeers:
await(self.logTool.logAsync(service='Geored', level='debug', message=f"[Geored] [handleWebhookQueue] Sending OCS Notification to: {remotePeer}"))
webhookTasks.append(self.sendWebhook(asyncSession=session, url=remotePeer, operation=webhookOperation, body=webhookBody, headers=webhookHeaders))
await asyncio.gather(*webhookTasks)
else:
for remotePeer in self.webhookPeers:
await(self.logTool.logAsync(service='Geored', level='debug', message=f"[Geored] [handleWebhookQueue] Sending Notification to: {remotePeer}"))
Expand Down

0 comments on commit 499d155

Please sign in to comment.