InMemoryJobBufferStorageStrategy

InMemoryJobBufferStorageStrategy

A JobBufferStorageStrategy which keeps the buffered jobs in memory. Should not be used in production, since it will lose data in the event of the server stopping.

Instead, use the DefaultJobQueuePlugin with the useDatabaseForBuffer: true option set, or the BullMQJobQueuePlugin or another custom strategy with persistent storage.

Signature

class InMemoryJobBufferStorageStrategy implements JobBufferStorageStrategy {
  protected protected bufferStorage = new Map<string, Set<Job>>();
  async add(bufferId: string, job: Job) => Promise<Job>;
  async bufferSize(bufferIds?: string[]) => Promise<{ [bufferId: string]: number }>;
  async flush(bufferIds?: string[]) => Promise<{ [bufferId: string]: Job[] }>;
}

Implements

Members

bufferStorage

property
type:

add

method
type:
(bufferId: string, job: Job) => Promise<Job>

bufferSize

method
type:
(bufferIds?: string[]) => Promise<{ [bufferId: string]: number }>

flush

method
type:
(bufferIds?: string[]) => Promise<{ [bufferId: string]: Job[] }>