Skip to main content

DefaultSchedulerPlugin

DefaultSchedulerPlugin

This plugin configures a default scheduling strategy that executes scheduled tasks using the database to ensure that each task is executed exactly once at the scheduled time, even if there are multiple instances of the worker running.

Example

import { DefaultSchedulerPlugin, VendureConfig } from '@vendure/core';

export const config: VendureConfig = {
plugins: [
DefaultSchedulerPlugin.init({
// The default is 60s, but you can override it here
defaultTimeout: '10s',
}),
],
};
Signature
class DefaultSchedulerPlugin {
static options: DefaultSchedulerPluginOptions = {
defaultTimeout: DEFAULT_TIMEOUT,
};
init(config: DefaultSchedulerPluginOptions) => ;
}

DefaultSchedulerPluginOptions

The options for the DefaultSchedulerPlugin.

Signature
interface DefaultSchedulerPluginOptions {
defaultTimeout?: string | number;
}

defaultTimeout

property
string | number
default:
60_000ms

The default timeout for scheduled tasks.