From a104eb15adada64e3a2e79525baa335a6f2fa4d1 Mon Sep 17 00:00:00 2001 From: Rogger Valverde Date: Fri, 3 Feb 2023 08:03:15 -0500 Subject: [PATCH] build(types): build types only once (#1652) --- docs/gitbook/guide/jobs/delayed.md | 4 +--- docs/gitbook/guide/retrying-failing-jobs.md | 4 ++++ package.json | 2 +- tsconfig-cjs.json | 4 +++- tsconfig.json | 2 ++ 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/gitbook/guide/jobs/delayed.md b/docs/gitbook/guide/jobs/delayed.md index 6ec91fd1c9..4a8990d7c5 100644 --- a/docs/gitbook/guide/jobs/delayed.md +++ b/docs/gitbook/guide/jobs/delayed.md @@ -1,5 +1,3 @@ -# Delayed - The jobs added to a queue will normally be processed as quick as some worker is available for dispatching them. However, it is also possible to add a delay parameter so that jobs will wait at least that amount of time before being processed. Note that this does not guarantee that the job will be processed at that exact delayed time, it depends on how busy the queue is when the time has passed and how many other delayed jobs are scheduled at that exact time. {% hint style="info" %} @@ -24,4 +22,4 @@ await myQueue.add('house', { color: 'white' }, { delay: 5000 }); ## Read more: -* 💡 [Queue Scheduler API Reference](https://github.com/taskforcesh/bullmq/blob/v1.91.1/docs/gitbook/api/bullmq.queuescheduler.md) +- 💡 [Queue Scheduler API Reference](https://github.com/taskforcesh/bullmq/blob/v1.91.1/docs/gitbook/api/bullmq.queuescheduler.md) diff --git a/docs/gitbook/guide/retrying-failing-jobs.md b/docs/gitbook/guide/retrying-failing-jobs.md index 4566120054..a8f0c81b96 100644 --- a/docs/gitbook/guide/retrying-failing-jobs.md +++ b/docs/gitbook/guide/retrying-failing-jobs.md @@ -4,6 +4,10 @@ When a processor throws an exception, the worker will catch it and move the job BullMQ supports retries of failed jobs using backoff functions. It is possible to use the built in backoff functions or provide custom ones. +{% hint style="danger" %} +In general, you should never throw anything that is not an Error object. There is an eslint rule for that if you want to enforce it: https://eslint.org/docs/latest/rules/no-throw-literal +{% endhint %} + For BullMQ to reschedule failed jobs, make sure you create a `QueueScheduler` for your queue. {% hint style="danger" %} diff --git a/package.json b/package.json index aaa20babe4..7131d7d236 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Queue for messages and jobs based on Redis", "main": "./dist/cjs/index.js", "module": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", + "types": "./dist/types/index.d.ts", "source": "./src/index.ts", "author": "Taskforce.sh Inc.", "license": "MIT", diff --git a/tsconfig-cjs.json b/tsconfig-cjs.json index 6c3026c081..03dd4c0ae2 100644 --- a/tsconfig-cjs.json +++ b/tsconfig-cjs.json @@ -2,6 +2,8 @@ "extends": "./tsconfig.json", "compilerOptions": { "module": "CommonJS", - "outDir": "dist/cjs" + "outDir": "dist/cjs", + "declaration": false, + "declarationDir": null } } diff --git a/tsconfig.json b/tsconfig.json index e23bb61d7e..37f0f99803 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,8 @@ "types": ["node"], "target": "ES2017", "module": "ES2020", + "incremental": true, + "declarationDir": "dist/types", "declaration": true, "outDir": "dist/esm", "sourceMap": true,