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