fix(valkey,tasks): prevent unhandled connection hangs in sandbox and constrain test directives

This commit is contained in:
Tyler Gillispie 2026-08-25 09:38:27 -07:00
parent a82136fc95
commit f5bafbca78
2 changed files with 16 additions and 2 deletions

View File

@ -6,8 +6,21 @@ const VALKEY_URL = Deno.env.get("VALKEY_URL") ||
export const valkey = VALKEY_URL export const valkey = VALKEY_URL
? new Redis(VALKEY_URL, { ? new Redis(VALKEY_URL, {
enableOfflineQueue: false, enableOfflineQueue: false,
maxRetriesPerRequest: 1,
retryStrategy: (times) => (times > 3 ? null : Math.min(times * 100, 1000)),
}) })
: new Redis({ lazyConnect: true, enableOfflineQueue: false }); : new Redis({
lazyConnect: true,
enableOfflineQueue: false,
maxRetriesPerRequest: 1,
retryStrategy: () => null,
});
valkey.on("error", (err) => {
if (Deno.env.get("DEBUG_VALKEY")) {
console.warn("[Valkey] Connection warning:", err.message);
}
});
export async function pingValkey(): Promise<void> { export async function pingValkey(): Promise<void> {
if (!VALKEY_URL) return; // Skip in test if (!VALKEY_URL) return; // Skip in test

View File

@ -47,7 +47,8 @@ in an existing task file._
2. Apply minimal, pure functional modifications. 2. Apply minimal, pure functional modifications.
3. Ensure all downstream pipeline steps and context contracts remain intact. 3. Ensure all downstream pipeline steps and context contracts remain intact.
4. Run all quality gates (`deno fmt`, `deno task lint`, `deno task check`, `deno task test`). 4. Run all quality gates (`deno fmt`, `deno task lint`, `deno task check`, `deno task test`).
5. Upon successful completion and verification, update the task status according to `tasks/GUIDELINES.md`. 5. Run ONLY unit tests (`deno task test` / `deno test --allow-all`). Do NOT execute `deno task start` or `deno task dev` (live database daemons are not running in sandbox containers).
6. Upon successful completion and verification, update the task status according to `tasks/GUIDELINES.md`.
``` ```
--- ---