Removed __repr__ as it's not used
This commit is contained in:
parent
b031b4d2f5
commit
34bc196c21
1 changed files with 3 additions and 5 deletions
|
@ -41,9 +41,6 @@ class Cache:
|
||||||
self.values = await _get_content(self.key)
|
self.values = await _get_content(self.key)
|
||||||
self.refreshed = pendulum.utcnow()
|
self.refreshed = pendulum.utcnow()
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return self.values
|
|
||||||
|
|
||||||
|
|
||||||
# Default bot's description
|
# Default bot's description
|
||||||
bot_description = global_config.get("description")
|
bot_description = global_config.get("description")
|
||||||
|
@ -127,10 +124,10 @@ async def save_content(table: str, content):
|
||||||
# Now that we've saved the new content, we should update our cache
|
# Now that we've saved the new content, we should update our cache
|
||||||
cached = cache.get(table)
|
cached = cache.get(table)
|
||||||
# While this should theoretically never happen, we just want to make sure
|
# While this should theoretically never happen, we just want to make sure
|
||||||
if cached is None:
|
if cached is None or len(cached.values) == 0:
|
||||||
cache[table] = Cache(table)
|
cache[table] = Cache(table)
|
||||||
else:
|
else:
|
||||||
await cache[table].update()
|
await cached.update()
|
||||||
|
|
||||||
|
|
||||||
async def get_content(key: str):
|
async def get_content(key: str):
|
||||||
|
@ -158,6 +155,7 @@ async def _get_content(key: str):
|
||||||
await conn.close()
|
await conn.close()
|
||||||
items = list(cursor.items)[0]
|
items = list(cursor.items)[0]
|
||||||
except (IndexError, r.ReqlOpFailedError):
|
except (IndexError, r.ReqlOpFailedError):
|
||||||
|
await conn.close()
|
||||||
return {}
|
return {}
|
||||||
# Rethink db stores an internal id per table, delete this and return the rest
|
# Rethink db stores an internal id per table, delete this and return the rest
|
||||||
del items['id']
|
del items['id']
|
||||||
|
|
Loading…
Reference in a new issue