mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
[document-updater] add missing await (#31034)
Co-authored-by: Brian Gough <brian.gough@overleaf.com> GitOrigin-RevId: f0602801ce80ca617027004ad36f71c1e6cdcdd2
This commit is contained in:
@@ -96,13 +96,21 @@ async function resyncProjectHistory(
|
||||
if (opts.resyncProjectStructureOnly) return
|
||||
const DocumentManager = require('./DocumentManager')
|
||||
|
||||
await promiseMapWithLimit(MAX_PARALLEL_REQUESTS, docs, doc => {
|
||||
DocumentManager.promises.resyncDocContentsWithLock(
|
||||
projectId,
|
||||
doc.doc,
|
||||
doc.path,
|
||||
opts
|
||||
)
|
||||
await promiseMapWithLimit(MAX_PARALLEL_REQUESTS, docs, async doc => {
|
||||
const { doc: docId, path } = doc
|
||||
try {
|
||||
await DocumentManager.promises.resyncDocContentsWithLock(
|
||||
projectId,
|
||||
docId,
|
||||
path,
|
||||
opts
|
||||
)
|
||||
} catch (err) {
|
||||
throw OError.tag(err, 'resyncDocContents', {
|
||||
projectId,
|
||||
docId,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable
|
||||
mocha/no-nested-tests,
|
||||
*/
|
||||
const { expect } = require('chai')
|
||||
const SandboxedModule = require('sandboxed-module')
|
||||
const sinon = require('sinon')
|
||||
const modulePath = require('node:path').join(
|
||||
@@ -206,6 +207,22 @@ describe('HistoryManager', function () {
|
||||
]
|
||||
})
|
||||
|
||||
describe('error', function () {
|
||||
it('should throw directly', async function () {
|
||||
const err = new Error()
|
||||
this.DocumentManager.promises.resyncDocContentsWithLock.rejects(err)
|
||||
await expect(
|
||||
this.HistoryManager.promises.resyncProjectHistory(
|
||||
this.project_id,
|
||||
this.projectHistoryId,
|
||||
this.docs,
|
||||
this.files,
|
||||
{}
|
||||
)
|
||||
).to.be.rejectedWith(err)
|
||||
})
|
||||
})
|
||||
|
||||
describe('full sync', function () {
|
||||
beforeEach(async function () {
|
||||
await this.HistoryManager.promises.resyncProjectHistory(
|
||||
|
||||
Reference in New Issue
Block a user