PromptBase
PromptBase SelectGet Select
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Skill Details

Runtime
(gpt-5.6)
Example user message
[userMessage]: Our NestJS BullMQ workers lose active jobs whenever Kubernetes replaces a pod. Repair the shutdown and recovery flow.
Example agent response
Project Detected: NestJS TypeScript workers using BullMQ, Redis, PostgreSQL, and Kubernetes --- Shutdown Path Reviewed: - Termination source: Kubernetes sends SIGTERM during rolling deployment - In-flight work: Report-generation jobs lasting between 20 and 90 seconds - Current shutdown behavior: The process closes Redis immediately and exits without waiting for active BullMQ jobs --- Data-Loss Risk Found: - Active jobs lose their final checkpoint when Redis closes before the worker drain completes - Work at risk: Report-generation jobs - Duplicate-work risk: Redelivered jobs can recreate email and storage side effects --- Shutdown Contract: - Stop new work: Pause local job acquisition and fail readiness immediately - Drain deadline: 90 seconds inside a 120-second Kubernetes termination period - Unfinished work: Save the last completed report stage and allow BullMQ redelivery - Resource close order: Worker, report services, database pool, Redis, telemetry --- Repair Applied: - Added one idempotent shutdown coordinator for SIGTERM and SIGINT - Added worker draining before Redis and database shutdown - Added durable stage checkpoints and unique report-delivery keys - Updated readiness and Kubernetes termination settings --- Files Modified: - src/main.ts - src/shutdown/shutdown-coordinator.ts - src/workers/report.worker.ts - src/reports/report-checkpoint.service.ts - src/health/readiness.controller.ts - deployment/worker-deployment.yml - test/report-shutdown-recovery.spec.ts --- Commands Executed: - npm run typecheck - npm test -- report-shutdown-recovery.spec.ts - npm run build - kubectl apply --dry-run=client -f deployment/worker-deployment.yml --- Termination Test: - Active work at signal: 10 report jobs interrupted at different stages - Completed before exit: 6 - Preserved or requeued: 4 - Lost work: 0 --- Restart Recovery Test: - Recovery action: Four jobs resumed after their last durable stage checkpoint - Duplicate side effects: 0 - Final state: All 10 reports completed once and generated one delivery record each --- Validation Result: Type checking, 18 shutdown tests, production build, and Kubernetes manifest validation completed successfully using isolated Redis and PostgreSQL services. --- Remaining Risks: - The production load balancer’s endpoint-removal delay was not available and must be confirmed before rollout
OpenClaw Skill

Stop Data Loss During Shutdown

Add to Cart
PromptBase Select
Get this skill + 9 more with Select$14 your first month, then $19/mo$14 first month, then $19/mo
View Select
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this skill, you agree to our terms of service
GPT-5.6
Tested icon
Guide icon
Free credits icon
Repair apps that lose jobs, events, or writes when containers restart, deployments roll, or processes receive termination signals. This skill traces shutdown behavior, in-flight work, queue acknowledgements, readiness, and timeouts. It adds graceful draining, safe checkpoints, bounded shutdown, and restart tests. ✔ Protect in-flight work ✔ Stop new traffic safely ✔ Preserve queue and job state ✔ Verify restart recovery Ideal for APIs, workers, containers, and distributed systems.
...more
Added over 1 month ago
Report
Browse Marketplace