catch invalid chunks on incremential backups
This commit is contained in:
parent
e12a9a24a7
commit
ef4b4ee07e
|
@ -111,9 +111,10 @@ export async function incrementialBackupRedis(
|
|||
const curChunk = await canvasRedis.getAsync(key);
|
||||
let tileBuffer = null;
|
||||
if (curChunk) {
|
||||
if (curChunk.length === TILE_SIZE * TILE_SIZE) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const oldChunk = await backupRedis.getAsync(key);
|
||||
if (oldChunk) {
|
||||
if (oldChunk && oldChunk.length === TILE_SIZE * TILE_SIZE) {
|
||||
let pxl = 0;
|
||||
while (pxl < curChunk.length) {
|
||||
if (curChunk[pxl] !== oldChunk[pxl]) {
|
||||
|
@ -128,6 +129,12 @@ export async function incrementialBackupRedis(
|
|||
} else {
|
||||
tileBuffer = palette.buffer2ABGR(curChunk);
|
||||
}
|
||||
} else {
|
||||
console.log(
|
||||
// eslint-disable-next-line max-len
|
||||
`Chunk ${x},${y} of canvas ${id} has invalid length ${curChunk.length}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (tileBuffer) {
|
||||
if (!createdDir && !fs.existsSync(xBackupDir)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user