.format(subscriber["subscriptionId"],
subscriber["authentication"]["authType"]))
- tasks = []
- async with aiohttp.ClientSession(loop=loop) as session:
- for notification in notifications:
- tasks.append(asyncio.ensure_future(self.send_notification(session, notification, loop=loop), loop=loop))
- await asyncio.gather(*tasks, loop=loop)
+ if notifications:
+ tasks = []
+ async with aiohttp.ClientSession(loop=loop) as session:
+ for notification in notifications:
+ tasks.append(asyncio.ensure_future(self.send_notification(session, notification, loop=loop),
+ loop=loop))
+ await asyncio.gather(*tasks, loop=loop)
async def send_notification(self, session: aiohttp.ClientSession, notification: dict,
loop: asyncio.AbstractEventLoop = None, retry_count: int = 5, timeout: float = 5.0):
event_details)
# self.logger.debug("subscribers list: ")
# self.logger.debug(subscribers)
- asyncio.ensure_future(self.nslcm.send_notifications(subscribers, loop=self.loop))
+ if subscribers:
+ asyncio.ensure_future(self.nslcm.send_notifications(subscribers, loop=self.loop),
+ loop=self.loop)
else:
self.logger.debug("Message can not be used for notification of nslcm")
elif topic == "nsi":