Open History to see the last commit
1---
2id: AsyncQueuerOptions
3title: AsyncQueuerOptions
4---
5
6Defined in: [async-queuer.ts:112](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L112)
7
8## Type Parameters
9
10### TValue
11
12`TValue`
13
14## Properties
15
16### addItemsTo?
17
18```ts
19optional addItemsTo?: QueuePosition;
20```
21
22Defined in: [async-queuer.ts:121](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L121)
23
24Default position to add items to the queuer
25
26#### Default
27
28```ts
29'back'
30```
31
32***
33
34### asyncRetryerOptions?
35
36```ts
37optional asyncRetryerOptions?: AsyncRetryerOptions<(item) => Promise<any>>;
38```
39
40Defined in: [async-queuer.ts:116](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L116)
41
42Options for configuring the underlying async retryer
43
44***
45
46### concurrency?
47
48```ts
49optional concurrency?: number | ((queuer) => number);
50```
51
52Defined in: [async-queuer.ts:127](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L127)
53
54Maximum number of concurrent tasks to process.
55Can be a number or a function that returns a number.
56
57#### Default
58
59```ts
601
61```
62
63***
64
65### expirationDuration?
66
67```ts
68optional expirationDuration?: number;
69```
70
71Defined in: [async-queuer.ts:132](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L132)
72
73Maximum time in milliseconds that an item can stay in the queue
74If not provided, items will never expire
75
76***
77
78### getIsExpired?
79
80```ts
81optional getIsExpired?: (item, addedAt) => boolean;
82```
83
84Defined in: [async-queuer.ts:137](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L137)
85
86Function to determine if an item has expired
87If provided, this overrides the expirationDuration behavior
88
89#### Parameters
90
91##### item
92
93`TValue`
94
95##### addedAt
96
97`number`
98
99#### Returns
100
101`boolean`
102
103***
104
105### getItemsFrom?
106
107```ts
108optional getItemsFrom?: QueuePosition;
109```
110
111Defined in: [async-queuer.ts:142](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L142)
112
113Default position to get items from during processing
114
115#### Default
116
117```ts
118'front'
119```
120
121***
122
123### getPriority?
124
125```ts
126optional getPriority?: (item) => number;
127```
128
129Defined in: [async-queuer.ts:148](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L148)
130
131Function to determine priority of items in the queuer
132Higher priority items will be processed first
133If not provided, will use static priority values attached to tasks
134
135#### Parameters
136
137##### item
138
139`TValue`
140
141#### Returns
142
143`number`
144
145***
146
147### initialItems?
148
149```ts
150optional initialItems?: TValue[];
151```
152
153Defined in: [async-queuer.ts:152](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L152)
154
155Initial items to populate the queuer with
156
157***
158
159### initialState?
160
161```ts
162optional initialState?: Partial<AsyncQueuerState<TValue>>;
163```
164
165Defined in: [async-queuer.ts:156](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L156)
166
167Initial state for the async queuer
168
169***
170
171### key?
172
173```ts
174optional key?: string;
175```
176
177Defined in: [async-queuer.ts:161](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L161)
178
179Optional key to identify this async queuer instance.
180If provided, the async queuer will be identified by this key in the devtools and PacerProvider if applicable.
181
182***
183
184### maxSize?
185
186```ts
187optional maxSize?: number;
188```
189
190Defined in: [async-queuer.ts:165](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L165)
191
192Maximum number of items allowed in the queuer
193
194***
195
196### onError?
197
198```ts
199optional onError?: (error, item, queuer) => void;
200```
201
202Defined in: [async-queuer.ts:171](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L171)
203
204Optional error handler for when a task throws.
205If provided, the handler will be called with the error and queuer instance.
206This can be used alongside throwOnError - the handler will be called before any error is thrown.
207
208#### Parameters
209
210##### error
211
212`Error`
213
214##### item
215
216`TValue`
217
218##### queuer
219
220[`AsyncQueuer`](../classes/AsyncQueuer.md)\<`TValue`\>
221
222#### Returns
223
224`void`
225
226***
227
228### onExpire?
229
230```ts
231optional onExpire?: (item, queuer) => void;
232```
233
234Defined in: [async-queuer.ts:175](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L175)
235
236Callback fired whenever an item expires in the queuer
237
238#### Parameters
239
240##### item
241
242`TValue`
243
244##### queuer
245
246[`AsyncQueuer`](../classes/AsyncQueuer.md)\<`TValue`\>
247
248#### Returns
249
250`void`
251
252***
253
254### onItemsChange?
255
256```ts
257optional onItemsChange?: (queuer) => void;
258```
259
260Defined in: [async-queuer.ts:179](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L179)
261
262Callback fired whenever an item is added or removed from the queuer
263
264#### Parameters
265
266##### queuer
267
268[`AsyncQueuer`](../classes/AsyncQueuer.md)\<`TValue`\>
269
270#### Returns
271
272`void`
273
274***
275
276### onReject?
277
278```ts
279optional onReject?: (item, queuer) => void;
280```
281
282Defined in: [async-queuer.ts:183](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L183)
283
284Callback fired whenever an item is rejected from being added to the queuer
285
286#### Parameters
287
288##### item
289
290`TValue`
291
292##### queuer
293
294[`AsyncQueuer`](../classes/AsyncQueuer.md)\<`TValue`\>
295
296#### Returns
297
298`void`
299
300***
301
302### onSettled?
303
304```ts
305optional onSettled?: (item, queuer) => void;
306```
307
308Defined in: [async-queuer.ts:187](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L187)
309
310Optional callback to call when a task is settled
311
312#### Parameters
313
314##### item
315
316`TValue`
317
318##### queuer
319
320[`AsyncQueuer`](../classes/AsyncQueuer.md)\<`TValue`\>
321
322#### Returns
323
324`void`
325
326***
327
328### onSuccess?
329
330```ts
331optional onSuccess?: (result, item, queuer) => void;
332```
333
334Defined in: [async-queuer.ts:191](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L191)
335
336Optional callback to call when a task succeeds
337
338#### Parameters
339
340##### result
341
342`any`
343
344##### item
345
346`TValue`
347
348##### queuer
349
350[`AsyncQueuer`](../classes/AsyncQueuer.md)\<`TValue`\>
351
352#### Returns
353
354`void`
355
356***
357
358### started?
359
360```ts
361optional started?: boolean;
362```
363
364Defined in: [async-queuer.ts:195](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L195)
365
366Whether the queuer should start processing tasks immediately or not.
367
368***
369
370### throwOnError?
371
372```ts
373optional throwOnError?: boolean;
374```
375
376Defined in: [async-queuer.ts:201](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L201)
377
378Whether to throw errors when they occur.
379Defaults to true if no onError handler is provided, false if an onError handler is provided.
380Can be explicitly set to override these defaults.
381
382***
383
384### wait?
385
386```ts
387optional wait?: number | ((queuer) => number);
388```
389
390Defined in: [async-queuer.ts:207](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/async-queuer.ts#L207)
391
392Time in milliseconds to wait between processing items.
393Can be a number or a function that returns a number.
394
395#### Default
396
397```ts
3980
399```