From 524a8e8e710ec03b6ad7ae72980dba318c07ee59 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 14:37:10 +0000 Subject: [PATCH 1/4] Initial plan From 5a7f28aaa194a4d9f2ae8af493abdbd757d7a2a2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 14:39:16 +0000 Subject: [PATCH 2/4] Initial plan Co-authored-by: FreekBes <36384333+FreekBes@users.noreply.github.com> --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 6bd6006..75877af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.5", "license": "ISC", "dependencies": { - "@sergiiivzhenko/bottleneck": "^2.19.7", + "@sergiiivzhenko/bottleneck": "2.19.7", "node-cache": "^5.1.2", "node-fetch": "^2.6.2", "redis": "^3.1.2" From 8c2879cab677f0d94e43936a8c65c9aa248b0592 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 14:42:19 +0000 Subject: [PATCH 3/4] Increase default job expiration to 60s and export BottleneckError Co-authored-by: FreekBes <36384333+FreekBes@users.noreply.github.com> --- src/index.ts | 5 ++++- tests/index.test.ts | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2e54679..befeb0d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -73,7 +73,7 @@ class Fast42 { * This is useful if you want to run multiple instances of your application, and want to share the rate limit counters between them. * */ - constructor(secrets: ApiSecret[], concurrentOffset: number = 0, jobExpiration: number = 20000, redisConfig?: RedisConfig) { + constructor(secrets: ApiSecret[], concurrentOffset: number = 0, jobExpiration: number = 60000, redisConfig?: RedisConfig) { if (secrets.length === 0) { throw new Error("Fast42 requires at least one 42 Api Key/Secret pair") } @@ -432,4 +432,7 @@ class Fast42 { export { Response } from "node-fetch" +const BottleneckError = Bottleneck.BottleneckError; +export { BottleneckError }; + export default Fast42 diff --git a/tests/index.test.ts b/tests/index.test.ts index a8f83e4..6a63fbb 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,4 +1,4 @@ -import Fast42 from '../src/index'; +import Fast42, { BottleneckError } from '../src/index'; const client_id = "test"; const client_secret = "test"; @@ -27,6 +27,14 @@ it("Should instantiate using Redis", () => { expect(api).toBeInstanceOf(Fast42); }) +it("Should export BottleneckError", () => { + expect(BottleneckError).toBeDefined(); + const err = new BottleneckError("test error"); + expect(err).toBeInstanceOf(Error); + expect(err).toBeInstanceOf(BottleneckError); + expect(err.message).toBe("test error"); +}) + // it("initializes using real keys", async () => { // const api = await (new Fast42([ // { From f2d325cd22bbd771653dcd7a4ad81e283592b45f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 14:49:06 +0000 Subject: [PATCH 4/4] Re-throw errors via Promise rejection (not event handler); revert on-error handler Co-authored-by: FreekBes <36384333+FreekBes@users.noreply.github.com> --- src/index.ts | 3 --- tests/index.test.ts | 10 +--------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/index.ts b/src/index.ts index befeb0d..c974812 100644 --- a/src/index.ts +++ b/src/index.ts @@ -432,7 +432,4 @@ class Fast42 { export { Response } from "node-fetch" -const BottleneckError = Bottleneck.BottleneckError; -export { BottleneckError }; - export default Fast42 diff --git a/tests/index.test.ts b/tests/index.test.ts index 6a63fbb..a8f83e4 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,4 +1,4 @@ -import Fast42, { BottleneckError } from '../src/index'; +import Fast42 from '../src/index'; const client_id = "test"; const client_secret = "test"; @@ -27,14 +27,6 @@ it("Should instantiate using Redis", () => { expect(api).toBeInstanceOf(Fast42); }) -it("Should export BottleneckError", () => { - expect(BottleneckError).toBeDefined(); - const err = new BottleneckError("test error"); - expect(err).toBeInstanceOf(Error); - expect(err).toBeInstanceOf(BottleneckError); - expect(err.message).toBe("test error"); -}) - // it("initializes using real keys", async () => { // const api = await (new Fast42([ // {