Sfoglia il codice sorgente

Remove old session data

John R. Supplee 4 anni fa
parent
commit
f2e7296d19
1 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. 13 1
      server/publications/cards.js

+ 13 - 1
server/publications/cards.js

@@ -547,7 +547,19 @@ Meteor.publish('globalSearch', function(sessionId, queryParams) {
     });
   }
 
-  SessionData.upsert({ userId: this.userId, sessionId }, update);
+  SessionData.upsert({ userId, sessionId }, update);
+
+  // remove old session data
+  SessionData.remove({
+    userId,
+    modifiedAt: {
+      $lt: new Date(
+        moment()
+          .subtract(1, 'day')
+          .format(),
+      ),
+    },
+  });
 
   if (cards) {
     const boards = [];