Fix cache
This commit is contained in:
parent
c8ee10b24c
commit
818ad7766e
1 changed files with 2 additions and 3 deletions
|
@ -73,15 +73,14 @@ class DbrandCog(commands.Cog):
|
||||||
if len(matches) > 0:
|
if len(matches) > 0:
|
||||||
search = matches[0]
|
search = matches[0]
|
||||||
dest = search
|
dest = search
|
||||||
if not self.cache.contains(dest):
|
data = self.cache.get(dest, None)
|
||||||
|
if not data:
|
||||||
api_link = self.api_url + dest
|
api_link = self.api_url + dest
|
||||||
data = await self._session.get(api_link)
|
data = await self._session.get(api_link)
|
||||||
if 200 <= data.status < 400:
|
if 200 <= data.status < 400:
|
||||||
data = await data.json()
|
data = await data.json()
|
||||||
else:
|
else:
|
||||||
data = None
|
data = None
|
||||||
self.cache.update(dest)
|
|
||||||
data = self.cache.get(dest)
|
|
||||||
fields = None
|
fields = None
|
||||||
if (
|
if (
|
||||||
data is not None
|
data is not None
|
||||||
|
|
Loading…
Add table
Reference in a new issue