mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 18:20:09 +02:00
Merge pull request #24993 from overleaf/bg-history-buffer-use-cache-in-persist-changes
use chunkBuffer in persistChanges GitOrigin-RevId: dd4cdf39ba53c3becf306119fed7eacfe67de15d
This commit is contained in:
@@ -11,6 +11,7 @@ const History = core.History
|
||||
|
||||
const assert = require('./assert')
|
||||
const chunkStore = require('./chunk_store')
|
||||
const chunkBuffer = require('./chunk_buffer')
|
||||
const { BlobStore } = require('./blob_store')
|
||||
const { InvalidChangeError } = require('./errors')
|
||||
const { getContentHash } = require('./content_hash')
|
||||
@@ -180,7 +181,7 @@ async function persistChanges(projectId, allChanges, limits, clientEndVersion) {
|
||||
}
|
||||
|
||||
async function extendLastChunkIfPossible() {
|
||||
const latestChunk = await chunkStore.loadLatest(projectId)
|
||||
const latestChunk = await chunkBuffer.loadLatest(projectId)
|
||||
|
||||
currentChunk = latestChunk
|
||||
originalEndVersion = latestChunk.getEndVersion()
|
||||
|
||||
@@ -22,6 +22,7 @@ const TextOperation = core.TextOperation
|
||||
const V2DocVersions = core.V2DocVersions
|
||||
|
||||
const knex = require('../../../../storage').knex
|
||||
const redis = require('../../../../storage/lib/chunk_store/redis')
|
||||
|
||||
describe('history import', function () {
|
||||
beforeEach(cleanup.everything)
|
||||
@@ -580,7 +581,7 @@ describe('history import', function () {
|
||||
.catch(expectResponse.unprocessableEntity)
|
||||
.then(getLatestContent)
|
||||
.then(response => {
|
||||
// Check that no chaes were made
|
||||
// Check that no changes were made
|
||||
const snapshot = Snapshot.fromRaw(response.obj)
|
||||
expect(snapshot.countFiles()).to.equal(1)
|
||||
expect(snapshot.getFile(mainFilePathname).getHash()).to.equal(
|
||||
@@ -594,6 +595,10 @@ describe('history import', function () {
|
||||
testFiles.NULL_CHARACTERS_TXT_BYTE_LENGTH
|
||||
)
|
||||
})
|
||||
.then(() => {
|
||||
// Now clear the cache because we have changed the string length in the database
|
||||
return redis.clearCache(testProjectId)
|
||||
})
|
||||
.then(importChanges)
|
||||
.then(getLatestContent)
|
||||
.then(response => {
|
||||
|
||||
Reference in New Issue
Block a user