From fabcb28aa96a16c67a45d31696d87cc5df41d28e Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 25 May 2021 02:04:12 +0200 Subject: [PATCH] :bug: fix Snowflake workerid --- src/util/Snowflake.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Snowflake.ts b/src/util/Snowflake.ts index e8056fc4..1d725710 100644 --- a/src/util/Snowflake.ts +++ b/src/util/Snowflake.ts @@ -14,7 +14,7 @@ export class Snowflake { static readonly EPOCH = 1420070400000; static INCREMENT = 0n; // max 4095 static processId = BigInt(process.pid % 31); // max 31 - static workerId = BigInt(cluster.worker.id % 31); // max 31 + static workerId = BigInt((cluster.worker?.id || 0) % 31); // max 31 constructor() { throw new Error(`The ${this.constructor.name} class may not be instantiated.`);