From 169385786412dedd2755c756cee9ea9588be5f10 Mon Sep 17 00:00:00 2001 From: Romain J Date: Sun, 25 Apr 2021 00:14:38 +0200 Subject: [PATCH] fix(commands:peeringdb|Network): possible false positiv --- tuxbot/cogs/Network/functions/utils.py | 6 +++--- tuxbot/cogs/Network/network.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tuxbot/cogs/Network/functions/utils.py b/tuxbot/cogs/Network/functions/utils.py index 321697e..f98c939 100644 --- a/tuxbot/cogs/Network/functions/utils.py +++ b/tuxbot/cogs/Network/functions/utils.py @@ -259,7 +259,7 @@ async def get_pydig_result( @cached( - ttl=24 * 3600, + ttl=5 * 60, serializer=PickleSerializer(), cache=Cache.MEMORY, namespace="network", @@ -269,7 +269,7 @@ async def get_peeringdb_net_result(asn: str) -> dict: # A. better do one request and save in cache than execute new # request every time @cached( - ttl=24 * 3600, + ttl=5 * 60, serializer=PickleSerializer(), cache=Cache.MEMORY, namespace="network", @@ -285,7 +285,7 @@ async def get_peeringdb_net_result(asn: str) -> dict: except asyncio.exceptions.TimeoutError: pass - return {"data": []} + return await _local_cache() result = await _local_cache() diff --git a/tuxbot/cogs/Network/network.py b/tuxbot/cogs/Network/network.py index 76e3962..426598c 100644 --- a/tuxbot/cogs/Network/network.py +++ b/tuxbot/cogs/Network/network.py @@ -86,7 +86,7 @@ class Network(commands.Cog): def cog_unload(self): self._update_peering_db.cancel() # pylint: disable=no-member - @tasks.loop(hours=24.0) + @tasks.loop(minutes=5.0) async def _update_peering_db(self): await get_peeringdb_net_result(str(1))