Remove debug prints

This commit is contained in:
Finn Stutzenstein 2021-02-15 11:32:24 +01:00
parent a3a126f930
commit fe0f8d28f4
No known key found for this signature in database
GPG Key ID: 9042F605C6324654

View File

@ -39,13 +39,9 @@ class SessionStore(SessionBase):
async with get_connection(read_only=True) as redis: async with get_connection(read_only=True) as redis:
try: try:
key = to_redis_key(self._get_or_create_session_key()) key = to_redis_key(self._get_or_create_session_key())
print("laod:", key)
session_data = await redis.get(key) session_data = await redis.get(key)
x = self.decode(force_str(session_data)) return self.decode(force_str(session_data))
print("load result:", x) except Exception:
return x
except Exception as e:
print("load ex", e)
self._session_key = None self._session_key = None
return {} return {}
@ -55,10 +51,7 @@ class SessionStore(SessionBase):
async def _exists(self, session_key): async def _exists(self, session_key):
async with get_connection(read_only=True) as redis: async with get_connection(read_only=True) as redis:
key = to_redis_key(session_key) key = to_redis_key(session_key)
print("exists:", key) return await redis.exists(key)
x = await redis.exists(key)
print("exists result:", x)
return x
def create(self): def create(self):
async_to_sync(self._create)() async_to_sync(self._create)()
@ -85,7 +78,6 @@ class SessionStore(SessionBase):
if must_create and await self._exists(self._get_or_create_session_key()): if must_create and await self._exists(self._get_or_create_session_key()):
raise CreateError raise CreateError
data = self.encode(self._get_session(no_load=must_create)) data = self.encode(self._get_session(no_load=must_create))
print("Save:", self._get_or_create_session_key(), data)
await redis.setex( await redis.setex(
to_redis_key(self._get_or_create_session_key()), to_redis_key(self._get_or_create_session_key()),
self.get_expiry_age(), self.get_expiry_age(),
@ -102,12 +94,7 @@ class SessionStore(SessionBase):
session_key = self.session_key session_key = self.session_key
async with get_connection() as redis: async with get_connection() as redis:
try:
print("delete:", to_redis_key(session_key))
await redis.delete(to_redis_key(session_key)) await redis.delete(to_redis_key(session_key))
except Exception as e:
print("delete ex:", e)
pass
# This must be overwritten to stay inside async code... # This must be overwritten to stay inside async code...
async def _async_get_new_session_key(self): async def _async_get_new_session_key(self):