From a36f1e8b66ea238ffdfcb5cf60af3d7ca5010914 Mon Sep 17 00:00:00 2001 From: sjaanus Date: Wed, 25 Jun 2025 15:49:13 +0300 Subject: [PATCH] feat: add transaction context store --- src/lib/util/transactionContext.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/util/transactionContext.ts b/src/lib/util/transactionContext.ts index 260104884f..b8552af8be 100644 --- a/src/lib/util/transactionContext.ts +++ b/src/lib/util/transactionContext.ts @@ -5,11 +5,10 @@ export interface OperationContext { id: number; } -// Generate a numeric transaction ID based on timestamp + random component function generateNumericTransactionId(): number { - const timestamp = Date.now(); // 13 digits - const random = Math.floor(Math.random() * 1000); // 3 digits max - return timestamp * 1000 + random; // Ensures uniqueness + const timestamp = Date.now(); + const random = Math.floor(Math.random() * 1000); + return timestamp * 1000 + random; } const storage = new AsyncLocalStorage();