# Class SinglePromiseQueue

A tiny utility that coalesces/enqueues async operations so only the latest queued task runs per cycle, while callers receive a promise that resolves when the task for the cycle they joined has completed.

- Defined in rivetkit-typescript/packages/rivetkit/src/utils.ts:141

##### Index

### Constructors

constructor

### Properties

runningDrainLoop?

### Methods

enqueue

## Constructors

### constructor

- new SinglePromiseQueue(): SinglePromiseQueue

  #### Returns SinglePromiseQueue

## Properties

### `Optional` runningDrainLoop

runningDrainLoop?: Promise<void>

The currently running promise of #drainLoop. Do not await this, instead await `pending` to await the current cycle.

- Defined in rivetkit-typescript/packages/rivetkit/src/utils.ts:146

## Methods

### enqueue

- enqueue(op: () => Promise<void>): Promise<void>

  Queue the next operation and return a promise that resolves when it flushes.

  #### Parameters

  - op: () => Promise<void>

  #### Returns Promise<void>

  - Defined in rivetkit-typescript/packages/rivetkit/src/utils.ts:152