Write behind reading progress as a list that can be reduced at commit or read time

This commit is contained in:
Jackson Harper
2024-01-31 09:28:09 +08:00
parent c2327781e1
commit fbfa934479
6 changed files with 137 additions and 131 deletions

View File

@ -28,6 +28,10 @@ import {
import { updatePDFContentJob } from './jobs/update_pdf_content'
import { redisDataSource } from './redis_data_source'
import { CustomTypeOrmLogger } from './utils/logger'
import {
SYNC_READ_POSITIONS_JOB_NAME,
syncReadPositionsJob,
} from './jobs/sync_read_positions'
export const QUEUE_NAME = 'omnivore-backend-queue'
@ -152,6 +156,21 @@ const main = async () => {
const worker = createWorker(workerRedisClient)
const queue = await getBackendQueue()
if (queue) {
await queue.add(
SYNC_READ_POSITIONS_JOB_NAME,
{},
{
priority: 1,
repeat: {
every: 10000,
limit: 100,
},
}
)
}
const queueEvents = new QueueEvents(QUEUE_NAME, {
connection: workerRedisClient,
})