MCPcopy Index your code
hub / github.com/formbricks/formbricks / withTimeout

Method withTimeout

packages/cache/src/service.ts:26–35  ·  view source on GitHub ↗

* Wraps Redis operations with connection check and timeout to prevent hanging

(operation: Promise<T>, timeoutMs = 1000)

Source from the content-addressed store, hash-verified

24 * Wraps Redis operations with connection check and timeout to prevent hanging
25 */
26 private async withTimeout<T>(operation: Promise<T>, timeoutMs = 1000): Promise<T> {
27 return Promise.race([
28 operation,
29 new Promise<T>((_, reject) => {
30 setTimeout(() => {
31 reject(new CacheErrorClass(ErrorCode.RedisOperationError, "Cache operation timeout"));
32 }, timeoutMs);
33 }),
34 ]);
35 }
36
37 /**
38 * Get the underlying Redis client for advanced operations (e.g., Lua scripts)

Callers 6

getMethod · 0.95
existsMethod · 0.95
setMethod · 0.95
delMethod · 0.95
tryLockMethod · 0.95
isRedisAvailableMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected