InMemoryJobQueueStrategy

InMemoryJobQueueStrategy

InMemoryJobQueueStrategy

An in-memory JobQueueStrategy. This is the default strategy if not using a dedicated JobQueue plugin (e.g. DefaultJobQueuePlugin). Not recommended for production, since the queue will be cleared when the server stops. Completed jobs will be evicted from the store every 2 hours to prevent a memory leak.

Signature

class InMemoryJobQueueStrategy implements JobQueueStrategy {
  protected protected jobs = new Map<ID, Job>();
  protected protected unsettledJobs: { [queueName: string]: Job[] } = {};
  init() => ;
  destroy() => ;
  async add(job: Job) => Promise<Job>;
  async findOne(id: ID) => Promise<Job | undefined>;
  async findMany(options?: JobListOptions) => Promise<PaginatedList<Job>>;
  async findManyById(ids: ID[]) => Promise<Job[]>;
  async next(queueName: string) => Promise<Job | undefined>;
  async update(job: Job) => Promise<void>;
  async removeSettledJobs(queueNames: string[] = [], olderThan?: Date) => Promise<number>;
}

Implements

Members

jobs

protected property
type:

unsettledJobs

protected property
type:
{ [queueName: string]: Job[] }

init

method
type:
() =>

destroy

method
type:
() =>

add

async method
type:
(job: Job) => Promise<Job>

findOne

async method
type:
(id: ID) => Promise<Job | undefined>

findMany

async method
type:
(options?: JobListOptions) => Promise<PaginatedList<Job>>

findManyById

async method
type:
(ids: ID[]) => Promise<Job[]>

next

async method
type:
(queueName: string) => Promise<Job | undefined>

update

async method
type:
(job: Job) => Promise<void>

removeSettledJobs

async method
type:
(queueNames: string[] = [], olderThan?: Date) => Promise<number>