feat: change cron to every
This commit is contained in:
parent
4a787cc041
commit
76d3826a65
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ export class AutopostService {
|
|||
return this._workerServiceProducer.emit('cron', {
|
||||
id,
|
||||
options: {
|
||||
cron: '1 * * * *',
|
||||
every: 3600000,
|
||||
immediately: true,
|
||||
},
|
||||
payload: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue