feat: change cron to every

This commit is contained in:
Nevo David 2025-02-14 16:41:42 +07:00
parent 4a787cc041
commit 76d3826a65
2 changed files with 4 additions and 4 deletions

View File

@ -80,12 +80,12 @@ export class BullMqClient extends ClientProxy {
async dispatchEvent(packet: ReadPacket<any>): Promise<any> {
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,

View File

@ -101,7 +101,7 @@ export class AutopostService {
return this._workerServiceProducer.emit('cron', {
id,
options: {
cron: '1 * * * *',
every: 3600000,
immediately: true,
},
payload: {