From d58e5ea0f2875d674590af39c63752c6d5050875 Mon Sep 17 00:00:00 2001 From: Jordan Husney Date: Fri, 1 Mar 2024 19:56:18 -0800 Subject: [PATCH] chore: better name for ScheduledJob migration - also: removed unecessary transform from earlier revision --- ...e.ts => 1709312768000_moveScheduledJob.ts} | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) rename packages/server/postgres/migrations/{1709312768000_scheduledJobMove.ts => 1709312768000_moveScheduledJob.ts} (80%) diff --git a/packages/server/postgres/migrations/1709312768000_scheduledJobMove.ts b/packages/server/postgres/migrations/1709312768000_moveScheduledJob.ts similarity index 80% rename from packages/server/postgres/migrations/1709312768000_scheduledJobMove.ts rename to packages/server/postgres/migrations/1709312768000_moveScheduledJob.ts index 46f2599f052..7d882d94fd1 100644 --- a/packages/server/postgres/migrations/1709312768000_scheduledJobMove.ts +++ b/packages/server/postgres/migrations/1709312768000_moveScheduledJob.ts @@ -15,26 +15,14 @@ export async function up() { {table: 'ScheduledJob'} ) - const transformRethinkRow = (row: any) => { - const {runAt, type, orgId, meetingId} = row - return { - runAt, - type, - orgId, - meetingId - } - } - const getNextData = async (leftBoundCursor: Date | undefined) => { const startAt = leftBoundCursor || r.minval - const nextBatch = ( - await r - .table('ScheduledJob') - .between(startAt, r.maxval, {index: 'runAt', leftBound: 'open'}) - .orderBy({index: 'runAt'}) - .limit(batchSize) - .run() - ).map(transformRethinkRow) + const nextBatch = await r + .table('ScheduledJob') + .between(startAt, r.maxval, {index: 'runAt', leftBound: 'open'}) + .orderBy({index: 'runAt'}) + .limit(batchSize) + .run() if (nextBatch.length === 0) return null if (nextBatch.length < batchSize) return nextBatch const lastItem = nextBatch.pop()