Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -7,7 +7,11 @@ import { createSharedStore, type SharedStore } from "@hivegrid/shared-store";
* bundler cycles do not open new Redis connections.
*/
let cachedStore: SharedStore | null = null;
let factory: () => SharedStore = () => createSharedStore({ namespace: "worker", redisUrl: process.env.REDIS_URL });
export function resolveWorkerSharedStoreRedisUrl(env: NodeJS.ProcessEnv = process.env): string | undefined {
return env.REDIS_URL?.trim() || env.BULLMQ_REDIS_URL?.trim() || undefined;
}
let factory: () => SharedStore = () => createSharedStore({ namespace: "worker", redisUrl: resolveWorkerSharedStoreRedisUrl() });
export function getSharedStore(): SharedStore {
if (cachedStore === null) {
@@ -16,12 +20,18 @@ export function getSharedStore(): SharedStore {
return cachedStore;
}
export async function closeSharedStore(): Promise<void> {
const store = cachedStore;
cachedStore = null;
await store?.close();
}
export function __setSharedStoreFactoryForTests(next: () => SharedStore): void {
factory = next;
cachedStore = null;
}
export function __resetSharedStoreForTests(): void {
factory = () => createSharedStore({ namespace: "worker", redisUrl: process.env.REDIS_URL });
factory = () => createSharedStore({ namespace: "worker", redisUrl: resolveWorkerSharedStoreRedisUrl() });
cachedStore = null;
}