-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
bugSomething isn't workingSomething isn't working
Description
async def websocket_loop():
"""Connect to the websocket and start listening for messages for Gobgp."""
logger.info("connecting to gobgp at %s", settings.gobgp_url)
g = GoBGP(settings.gobgp_url)
async for websocket in websockets.connect(settings.scram_events_url):
try:
async for message in websocket:
await process(message, websocket, g)
except websockets.ConnectionClosed:
continueSeems really close to main() at least as far connecting to the websocket
async def main():
"""Connect to the websocket and start listening for messages."""
while True:
try:
logger.debug("connecting to gobgp at %s", settings.gobgp_url)
g = GoBGP(settings.gobgp_url)
async for websocket in websockets.connect(settings.scram_events_url):
heartbeat_task = asyncio.create_task(heartbeat(websocket, g))
try:
async for message in websocket:
await process(message, websocket, g)
except websockets.ConnectionClosed:
heartbeat_task.cancel()
continue
finally:
heartbeat_task.cancel()
except RpcError as e:
logger.warning("Encountered an error connecting to gobgp, retrying in 10s, error is: %s", e)
await asyncio.sleep(10)
except Exception:
logger.exception("Unexpected error in main loop, retrying in 10s")
await asyncio.sleep(10)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working