diff --git a/services/docstore/config/settings.defaults.js b/services/docstore/config/settings.defaults.js index 9ad506a9bd..018ecedc02 100644 --- a/services/docstore/config/settings.defaults.js +++ b/services/docstore/config/settings.defaults.js @@ -41,7 +41,7 @@ const Settings = { max_doc_length: parseInt(process.env.MAX_DOC_LENGTH) || 2 * 1024 * 1024, // 2mb maxJsonRequestSize: - parseInt(process.env.MAX_JSON_REQUEST_SIZE) || 6 * 1024 * 1024, // 6 MB + parseInt(process.env.MAX_JSON_REQUEST_SIZE) || 12 * 1024 * 1024, // 6 MB unArchiveBatchSize: parseInt(process.env.UN_ARCHIVE_BATCH_SIZE, 10) || 50, parallelArchiveJobs: parseInt(process.env.PARALLEL_ARCHIVE_JOBS, 10) || 5, diff --git a/services/docstore/test/acceptance/js/UpdatingDocsTests.js b/services/docstore/test/acceptance/js/UpdatingDocsTests.js index 8793341483..43f75b6976 100644 --- a/services/docstore/test/acceptance/js/UpdatingDocsTests.js +++ b/services/docstore/test/acceptance/js/UpdatingDocsTests.js @@ -521,11 +521,9 @@ describe('Applying updates to a doc', function () { return describe('when the json payload is too large', function () { beforeEach(function (done) { - const line = new Array(1025).join('x') // 1kb - this.largeLines = Array.apply(null, Array(1024)).map(() => line) // 1kb - this.originalRanges.padding = Array.apply(null, Array(6144)).map( - () => line - ) // 6mb + const line = new Array(1024).join('x') // 1 KB + this.largeLines = new Array(8192).fill(line) // 8 MB + this.originalRanges.padding = new Array(6144).fill(line) // 6 MB return DocstoreClient.updateDoc( this.project_id, this.doc_id, diff --git a/services/history-v1/app.js b/services/history-v1/app.js index dd991c1a6d..f5997604e7 100644 --- a/services/history-v1/app.js +++ b/services/history-v1/app.js @@ -34,7 +34,7 @@ Metrics.leaked_sockets.monitor(logger) // We may have fairly large JSON bodies when receiving large Changes. Clients // may have to handle 413 status codes and try creating files instead of sending // text content in changes. -app.use(bodyParser.json({ limit: '6MB' })) +app.use(bodyParser.json({ limit: '12MB' })) app.use( bodyParser.urlencoded({ extended: false, diff --git a/services/history-v1/storage/lib/persist_changes.js b/services/history-v1/storage/lib/persist_changes.js index d2ca00053f..851960c1eb 100644 --- a/services/history-v1/storage/lib/persist_changes.js +++ b/services/history-v1/storage/lib/persist_changes.js @@ -119,7 +119,10 @@ async function persistChanges(projectId, allChanges, limits, clientEndVersion) { const change = changes[0] const changeBytes = countChangeBytes(change) - if (totalBytes + changeBytes > limits.maxChunkChangeBytes) { + if ( + chunk.getChanges().length > 0 && + totalBytes + changeBytes > limits.maxChunkChangeBytes + ) { break }