client.defineJob({
id: "unregister-job",
name: "Unregister dynamic trigger",
version: "0.1.1",
trigger: eventTrigger({
  name: "dynamic.unregister",
  schema: z.object({
    id: z.string(),
  }),
}),
run: async (payload, io, ctx) => {
  //unregisters a DynamicSchedule with a CRON 
  await io.unregisterTrigger("unregister", dynamicTrigger, payload.id);
},
});

This has been deprecated in favor of DynamicTrigger.unregister

Parameters

cacheKey
string
required

Should be a stable and unique cache key inside the run(). See resumability for more information.

dynamicTrigger
DynamicTrigger
required

A DynamicTrigger that will trigger any Jobs it’s attached to.

id
string
required

A unique id for the trigger. This is used to identify and unregister it later.

Returns

A Promise with the following shape:

ok
boolean
required

Whether it was successfully unregistered.

Was this page helpful?