From 76d3826a65d062a756ac1276ce8e447090907c1e Mon Sep 17 00:00:00 2001 From: Nevo David Date: Fri, 14 Feb 2025 16:41:42 +0700 Subject: [PATCH] feat: change cron to every --- .../nestjs-libraries/src/bull-mq-transport-new/client.ts | 6 +++--- .../src/database/prisma/autopost/autopost.service.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/nestjs-libraries/src/bull-mq-transport-new/client.ts b/libraries/nestjs-libraries/src/bull-mq-transport-new/client.ts index 7f042333..00d54911 100644 --- a/libraries/nestjs-libraries/src/bull-mq-transport-new/client.ts +++ b/libraries/nestjs-libraries/src/bull-mq-transport-new/client.ts @@ -80,12 +80,12 @@ export class BullMqClient extends ClientProxy { async dispatchEvent(packet: ReadPacket): Promise { console.log('event to dispatch: ', packet); const queue = this.getQueue(packet.pattern); - if (packet.data.options.cron) { - const { cron, immediately } = packet.data.options; + if (packet.data.options.every) { + const { every, immediately } = packet.data.options; const id = packet.data.id ?? v4(); await queue.upsertJobScheduler( id, - { pattern: cron, ...(immediately ? { immediately } : {}) }, + { every, ...(immediately ? { immediately } : {}) }, { name: id, data: packet.data, diff --git a/libraries/nestjs-libraries/src/database/prisma/autopost/autopost.service.ts b/libraries/nestjs-libraries/src/database/prisma/autopost/autopost.service.ts index 84d153c5..d0250453 100644 --- a/libraries/nestjs-libraries/src/database/prisma/autopost/autopost.service.ts +++ b/libraries/nestjs-libraries/src/database/prisma/autopost/autopost.service.ts @@ -101,7 +101,7 @@ export class AutopostService { return this._workerServiceProducer.emit('cron', { id, options: { - cron: '1 * * * *', + every: 3600000, immediately: true, }, payload: {