mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 10:10:08 +02:00
Merge pull request #26377 from overleaf/bg-history-redis-remove-unwanted-parameters
remove unwanted parameters in queueChangesFake and queueChangesFakeOnlyIfExists functions GitOrigin-RevId: 5946cd1f81db7076eb545b5a0aca28b81fa19be4
This commit is contained in:
@@ -65,10 +65,10 @@ async function commitChanges(
|
||||
await queueChanges(projectId, changes, endVersion)
|
||||
return await persistBuffer(projectId, limits)
|
||||
case 2: // Equivalent to queueChangesInRedis:true
|
||||
await queueChangesFake(projectId, changes, limits, endVersion)
|
||||
await queueChangesFake(projectId, changes, endVersion)
|
||||
return await persistChanges(projectId, changes, limits, endVersion)
|
||||
case 1: // Queue changes with fake persist only for projects in redis already
|
||||
await queueChangesFakeOnlyIfExists(projectId, changes, limits, endVersion)
|
||||
await queueChangesFakeOnlyIfExists(projectId, changes, endVersion)
|
||||
return await persistChanges(projectId, changes, limits, endVersion)
|
||||
case 0: // Persist changes directly to the chunk store
|
||||
return await persistChanges(projectId, changes, limits, endVersion)
|
||||
@@ -81,20 +81,13 @@ async function commitChanges(
|
||||
* Queues a set of changes in redis as if they had been persisted, ignoring any errors.
|
||||
* @param {string} projectId
|
||||
* @param {Change[]} changes
|
||||
* @param {Object} limits
|
||||
* @param {number} endVersion
|
||||
* @param {Object} [options]
|
||||
* @param {boolean} [options.onlyIfExists] - If true, only queue changes if the project
|
||||
* already exists in Redis.
|
||||
*/
|
||||
|
||||
async function queueChangesFake(
|
||||
projectId,
|
||||
changes,
|
||||
limits,
|
||||
endVersion,
|
||||
options = {}
|
||||
) {
|
||||
async function queueChangesFake(projectId, changes, endVersion, options = {}) {
|
||||
try {
|
||||
await queueChanges(projectId, changes, endVersion)
|
||||
await fakePersistRedisChanges(projectId, changes, endVersion)
|
||||
@@ -107,17 +100,11 @@ async function queueChangesFake(
|
||||
* Queues changes in Redis, simulating persistence, but only if the project already exists.
|
||||
* @param {string} projectId - The ID of the project.
|
||||
* @param {Change[]} changes - An array of changes to be queued.
|
||||
* @param {Object} limits - Limits for the changes.
|
||||
* @param {number} endVersion - The expected version of the project before these changes are applied.
|
||||
*/
|
||||
|
||||
async function queueChangesFakeOnlyIfExists(
|
||||
projectId,
|
||||
changes,
|
||||
limits,
|
||||
endVersion
|
||||
) {
|
||||
await queueChangesFake(projectId, changes, limits, endVersion, {
|
||||
async function queueChangesFakeOnlyIfExists(projectId, changes, endVersion) {
|
||||
await queueChangesFake(projectId, changes, endVersion, {
|
||||
onlyIfExists: true,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user