فهرست منبع

Merge pull request #11096 from overleaf/bg-clear-first-op-timestamp-when-removing-updates

clear first op timestamp when removing updates

GitOrigin-RevId: d561cf94df158457e58b14823e4572baac56e6d3
Brian Gough 3 سال پیش
والد
کامیت
3faff3388d
2فایلهای تغییر یافته به همراه9 افزوده شده و 6 حذف شده
  1. 7 2
      services/project-history/app/js/SyncManager.js
  2. 2 4
      services/project-history/app/js/UpdatesProcessor.js

+ 7 - 2
services/project-history/app/js/SyncManager.js

@@ -75,11 +75,16 @@ export function startHardResync(projectId, options, callback) {
         if (err) {
           return releaseLock(OError.tag(err))
         }
-        RedisManager.destroyDocUpdatesQueue(projectId, function (err) {
+        RedisManager.clearFirstOpTimestamp(projectId, function (err) {
           if (err) {
             return releaseLock(OError.tag(err))
           }
-          _startResyncWithoutLock(projectId, options, releaseLock)
+          RedisManager.destroyDocUpdatesQueue(projectId, function (err) {
+            if (err) {
+              return releaseLock(OError.tag(err))
+            }
+            _startResyncWithoutLock(projectId, options, releaseLock)
+          })
         })
       }),
     function (error) {

+ 2 - 4
services/project-history/app/js/UpdatesProcessor.js

@@ -82,10 +82,8 @@ export function processUpdatesForProject(projectId, callback) {
         OError.tag(error)
       }
       ErrorRecorder.record(projectId, queueSize, error, callback)
-      if (error == null) {
-        // clear the flush marker in the background if the queue was fully cleared
-        RedisManager.clearFirstOpTimestamp(projectId)
-      }
+      // clear the timestamp in the background if the queue is now empty
+      RedisManager.clearDanglingFirstOpTimestamp(projectId, () => {})
     }
   )
 }