Skip to content

Commit ab4a14e

Browse files
committed
Rename skipIfFull to dropIfQueueFull
1 parent 01b7cea commit ab4a14e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/lib/D4C.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,9 @@ test("Instance usage: option inheritPreErr enable: task2 inherit task1's error i
846846
t.is(error.message, 'some_error')
847847
})
848848

849-
test('Instance usage: test option skipIfFull', async (t) => {
849+
test('Instance usage: test option dropIfQueueFull', async (t) => {
850850
const d4c = new D4C([{ concurrency: { limit: 2 } }])
851-
const fn1 = d4c.wrap(timeout, { skipIfFull: true })
851+
const fn1 = d4c.wrap(timeout, { dropIfQueueFull: true })
852852

853853
let error = null
854854
try {

src/lib/D4C.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ function checkIfDecoratorOptionObject(obj: any): boolean {
214214
(typeof obj.inheritPreErr === 'boolean' ||
215215
obj.inheritPreErr === undefined) &&
216216
(typeof obj.noBlockCurr === 'boolean' || obj.noBlockCurr === undefined) &&
217-
(typeof obj.skipIfFull === 'boolean' || obj.skipIfFull === undefined) &&
217+
(typeof obj.dropIfQueueFull === 'boolean' ||
218+
obj.dropIfQueueFull === undefined) &&
218219
checkTag(obj.tag)
219220
) {
220221
return true
@@ -242,7 +243,7 @@ export function concurrent(option?: {
242243
tag?: string | symbol
243244
inheritPreErr?: boolean
244245
noBlockCurr?: boolean
245-
skipIfFull?: boolean
246+
dropIfQueueFull?: boolean
246247
}): MethodDecoratorType
247248
export function concurrent(
248249
targetOrOption?: any,
@@ -332,7 +333,7 @@ function _q<T extends IAnyFn>(
332333
tag?: QueueTag
333334
inheritPreErr?: boolean
334335
noBlockCurr?: boolean
335-
skipIfFull?: boolean
336+
dropIfQueueFull?: boolean
336337
}
337338
): (...args: Parameters<typeof func>) => Promise<UnwrapPromise<typeof func>> {
338339
return async function (...args: any[]): Promise<any> {
@@ -385,7 +386,7 @@ function _q<T extends IAnyFn>(
385386
let err: Error
386387
let task: Task
387388
if (taskQueue.runningTask === taskQueue.concurrency) {
388-
if (!option?.skipIfFull) {
389+
if (!option?.dropIfQueueFull) {
389390
const promise = new Promise(function (resolve) {
390391
task = {
391392
unlock: resolve,
@@ -537,7 +538,7 @@ export class D4C {
537538
tag?: string | symbol
538539
inheritPreErr?: boolean
539540
noBlockCurr?: boolean
540-
skipIfFull?: boolean
541+
dropIfQueueFull?: boolean
541542
args?: Parameters<typeof func>
542543
}
543544
): Promise<UnwrapPromise<typeof func>> {
@@ -552,7 +553,7 @@ export class D4C {
552553
tag?: string | symbol
553554
inheritPreErr?: boolean
554555
noBlockCurr?: boolean
555-
skipIfFull?: boolean
556+
dropIfQueueFull?: boolean
556557
}
557558
): (...args: Parameters<typeof func>) => Promise<UnwrapPromise<typeof func>> {
558559
if (!option || checkTag(option.tag)) {

0 commit comments

Comments
 (0)