mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-29 12:01:32 +02:00
Merge pull request #11287 from overleaf/bg-clear-first-op-timestamp-2
clear the first op timestamp whenever the queue is processed (2nd attempt) GitOrigin-RevId: 0764ca6360b2a9203e5d32499213b312563a2c47
This commit is contained in:
@@ -234,6 +234,7 @@ _mocks.deleteAppliedDocUpdates = (project_id, updates, callback) => {
|
||||
status: 'lrem',
|
||||
})
|
||||
multi.lrem(Keys.projectHistoryOps({ project_id }), 1, update)
|
||||
multi.del(Keys.projectHistoryFirstOpTimestamp({ project_id }))
|
||||
}
|
||||
multi.exec(callback)
|
||||
}
|
||||
@@ -247,7 +248,11 @@ export function destroyDocUpdatesQueue(project_id, callback) {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
return rclient.del(Keys.projectHistoryOps({ project_id }), callback)
|
||||
return rclient.del(
|
||||
Keys.projectHistoryOps({ project_id }),
|
||||
Keys.projectHistoryFirstOpTimestamp({ project_id }),
|
||||
callback
|
||||
)
|
||||
}
|
||||
|
||||
// iterate over keys asynchronously using redis scan (non-blocking)
|
||||
|
||||
@@ -27,6 +27,7 @@ describe('RedisManager', function () {
|
||||
lrange: sinon.stub(),
|
||||
lrem: sinon.stub(),
|
||||
srem: sinon.stub(),
|
||||
del: sinon.stub(),
|
||||
}
|
||||
this.rclient.multi = sinon.stub().returns(this.rclient)
|
||||
this.RedisWrapper = {
|
||||
@@ -39,6 +40,9 @@ describe('RedisManager', function () {
|
||||
projectHistoryOps({ project_id }) {
|
||||
return `Project:HistoryOps:${project_id}`
|
||||
},
|
||||
projectHistoryFirstOpTimestamp({ project_id }) {
|
||||
return `ProjectHistory:FirstOpTimestamp:{${project_id}}`
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -132,6 +136,12 @@ describe('RedisManager', function () {
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
it('should clear the first op timestamp', function () {
|
||||
return this.rclient.del
|
||||
.calledWith(`ProjectHistory:FirstOpTimestamp:{${this.project_id}}`)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
return it('should call the callback ', function () {
|
||||
return this.callback.called.should.equal(true)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user