IO
io.unregisterCron()
io.unregisterCron()
allows you to unregister a DynamicSchedule that was previously registered with io.registerCron()
.
This has been deprecated in favor of DynamicSchedule.unregister
Parameters
keyrequired
string
Should be a stable and unique key inside the run()
. See
resumability for more information.
dynamicSchedulerequired
DynamicSchedule
A DynamicSchedule that will trigger any Jobs itβs attached to on a regular interval.
idrequired
string
A unique id for the schedule. This is used to identify and unregister the schedule later.
Returns
A Promise with the following shape:
okrequired
boolean
Whether the schedule was successfully unregistered.
client.defineJob({
id: "unregister-job",
name: "Unregister dynamic schedule",
version: "0.1.1",
trigger: eventTrigger({
name: "schedule.unregister",
schema: z.object({
id: z.string(),
}),
}),
run: async (payload, io, ctx) => {
//unregisters a DynamicSchedule with a CRON
await io.unregisterCron("βπ", dynamicSchedule, payload.id);
},
});
Was this page helpful?
client.defineJob({
id: "unregister-job",
name: "Unregister dynamic schedule",
version: "0.1.1",
trigger: eventTrigger({
name: "schedule.unregister",
schema: z.object({
id: z.string(),
}),
}),
run: async (payload, io, ctx) => {
//unregisters a DynamicSchedule with a CRON
await io.unregisterCron("βπ", dynamicSchedule, payload.id);
},
});