1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-27 01:19:00 +02:00

feat: add transaction context store

This commit is contained in:
sjaanus 2025-06-25 15:49:13 +03:00
parent 2570fe5e97
commit a36f1e8b66
No known key found for this signature in database
GPG Key ID: 20E007C0248BA7FF

View File

@ -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<OperationContext>();