()
| 10 | |
| 11 | |
| 12 | async def ping_server(): |
| 13 | sleep_time = PING_INTERVAL |
| 14 | while True: |
| 15 | await asyncio.sleep(sleep_time) |
| 16 | try: |
| 17 | async with aiohttp.ClientSession( |
| 18 | timeout=aiohttp.ClientTimeout(total=10) |
| 19 | ) as session: |
| 20 | async with session.get(Var.URL) as resp: |
| 21 | logging.info("Pinged server with response: {}".format(resp.status)) |
| 22 | except TimeoutError: |
| 23 | logging.warning("Couldn't connect to the site URL..!") |
| 24 | except Exception: |
| 25 | traceback.print_exc() |