浏览代码

Remove old session data

John R. Supplee 4 年之前
父节点
当前提交
f2e7296d19
共有 1 个文件被更改,包括 13 次插入1 次删除
  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 = [];