JobsRuntime
Implements
Section titled “Implements”OnApplicationBootstrapOnModuleDestroyOnApplicationShutdown
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new JobsRuntime(
options,discovery,scanner,reflector,moduleRef):JobsRuntime
Parameters
Section titled “Parameters”options
Section titled “options”discovery
Section titled “discovery”DiscoveryService
scanner
Section titled “scanner”MetadataScanner
reflector
Section titled “reflector”Reflector
moduleRef
Section titled “moduleRef”ModuleRef
Returns
Section titled “Returns”JobsRuntime
Accessors
Section titled “Accessors”producerConnection
Section titled “producerConnection”Get Signature
Section titled “Get Signature”get producerConnection():
Redis
The shared producer client. Exposed for health checks; never send blocking commands on it.
Returns
Section titled “Returns”Redis
scheduledSweeps
Section titled “scheduledSweeps”Get Signature
Section titled “Get Signature”get scheduledSweeps(): readonly
string[]
The sweeps scheduled at boot, by name.
Returns
Section titled “Returns”readonly string[]
Methods
Section titled “Methods”close()
Section titled “close()”close():
Promise<void>
Drains, then closes every queue and the producer connection, in that order. Idempotent.
Returns
Section titled “Returns”Promise<void>
drain()
Section titled “drain()”drain(
timeoutMs?):Promise<DrainResult>
Stops every worker from taking new jobs and waits up to timeoutMs for the
running ones. A worker still busy after that is closed anyway: its jobs’
locks lapse and another worker picks them up as stalled. Idempotent.
Parameters
Section titled “Parameters”timeoutMs?
Section titled “timeoutMs?”number
Returns
Section titled “Returns”Promise<DrainResult>
onApplicationBootstrap()
Section titled “onApplicationBootstrap()”onApplicationBootstrap():
Promise<void>
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”OnApplicationBootstrap.onApplicationBootstrap
onApplicationShutdown()
Section titled “onApplicationShutdown()”onApplicationShutdown():
Promise<void>
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”OnApplicationShutdown.onApplicationShutdown
onModuleDestroy()
Section titled “onModuleDestroy()”onModuleDestroy():
Promise<void>
Nest’s own shutdown hooks, for apps that do not use the shutdown helper.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”OnModuleDestroy.onModuleDestroy
queue()
Section titled “queue()”queue<
Jobs>(definition):JobQueue<Jobs>
The JobQueue of definition, created on first use. One policy per queue name.
Type Parameters
Section titled “Type Parameters”Jobs extends object
Parameters
Section titled “Parameters”definition
Section titled “definition”QueueDefinition<Jobs>
Returns
Section titled “Returns”JobQueue<Jobs>
whenSweepsScheduled()
Section titled “whenSweepsScheduled()”whenSweepsScheduled():
Promise<void>
Resolves once the sweep schedulers are in Redis and stale ones are removed.
Returns
Section titled “Returns”Promise<void>