You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/08 16:17:39 UTC
[incubator-ponymail-foal] 02/02: Move down,
so we have a DB object before calling save_session().
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 6cd67d93e115f2495cc5b70909e979f252aa3413
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 8 18:17:10 2020 +0200
Move down, so we have a DB object before calling save_session().
---
server/plugins/session.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/server/plugins/session.py b/server/plugins/session.py
index 087f1c7..40f64a8 100644
--- a/server/plugins/session.py
+++ b/server/plugins/session.py
@@ -111,15 +111,16 @@ async def get_session(
del server.data.sessions[session_id]
else:
- # Do we need to update the timestamp in ES?
- if (now - x_session.last_accessed) > FOAL_SAVE_SESSION_INTERVAL:
- x_session.last_accessed = now
- await save_session(x_session)
-
# Make a copy so we don't have a race condition with the database pool object
# In case the session is used twice within the same loop
session = copy.copy(x_session)
session.database = await server.dbpool.get()
+
+ # Do we need to update the timestamp in ES?
+ if (now - session.last_accessed) > FOAL_SAVE_SESSION_INTERVAL:
+ session.last_accessed = now
+ await save_session(session)
+
return session
# If not in local memory, start a new session object