Merge pull request #2714 from overleaf/cmg-jpa-call-stack-exceeded

Stop call stack from being exceeding when adding many files

GitOrigin-RevId: 1983b0c16cb279c6f173f614d541d16852664e24
This commit is contained in:
Simon Detheridge 2020-04-08 14:44:01 +01:00 committed by Copybot
parent 61e338fa7d
commit 0586f4d682
2 changed files with 8 additions and 4 deletions

View file

@ -43,9 +43,13 @@ module.exports = ProjectRootDocManager = {
ProjectEntityUpdateHandler.isPathValidForRootDoc(path) && ProjectEntityUpdateHandler.isPathValidForRootDoc(path) &&
DocumentHelper.contentHasDocumentclass(doc.lines) DocumentHelper.contentHasDocumentclass(doc.lines)
) { ) {
return cb(doc._id) async.setImmediate(function() {
cb(doc._id)
})
} else { } else {
return cb(null) async.setImmediate(function() {
cb(null)
})
} }
} }
) )

View file

@ -113,7 +113,7 @@ describe('ProjectRootDocManager', function() {
}) })
describe('when the root doc is an Rtex file', function() { describe('when the root doc is an Rtex file', function() {
beforeEach(function() { beforeEach(function(done) {
this.docs = { this.docs = {
'/chapter1.tex': { '/chapter1.tex': {
_id: 'doc-id-1', _id: 'doc-id-1',
@ -129,7 +129,7 @@ describe('ProjectRootDocManager', function() {
.callsArgWith(1, null, this.docs) .callsArgWith(1, null, this.docs)
return this.ProjectRootDocManager.setRootDocAutomatically( return this.ProjectRootDocManager.setRootDocAutomatically(
this.project_id, this.project_id,
this.callback done
) )
}) })