overleaf-cep/services/history-v1/storage/scripts/verify_project.mjs
Brian Gough 835e14b8b2 Merge pull request #24768 from overleaf/bg-history-redis-buffer
test redis caching when loading latest chunk in history-v1

GitOrigin-RevId: f0ee09e5e9e1d7605e228913cb8539be4134e1f7
2025-04-15 08:05:03 +00:00

35 lines
941 B
JavaScript

import commandLineArgs from 'command-line-args'
import { verifyProjectWithErrorContext } from '../lib/backupVerifier.mjs'
import knex from '../lib/knex.js'
import { client } from '../lib/mongodb.js'
import redis from '../lib/redis.js'
import { setTimeout } from 'node:timers/promises'
import { loadGlobalBlobs } from '../lib/blob_store/index.js'
const { historyId } = commandLineArgs([{ name: 'historyId', type: String }])
async function gracefulShutdown(code = process.exitCode) {
await knex.destroy()
await client.close()
await redis.disconnect()
await setTimeout(1_000)
process.exit(code)
}
if (!historyId) {
console.error('missing --historyId')
process.exitCode = 1
await gracefulShutdown()
}
await loadGlobalBlobs()
try {
await verifyProjectWithErrorContext(historyId)
console.log('OK')
} catch (error) {
console.error('error verifying', error)
process.exitCode = 1
} finally {
await gracefulShutdown()
}