$ show seomoz/qless
Qless is a mature, Redis-backed job queue system for Ruby, inspired by Resque but with richer features like job dependencies, priorities, retries, recurring jobs, heartbeating, and per-queue statistics. Its architecture is a Ruby client library with a Sinatra web UI for monitoring, and it uses Lua scripts loaded into Redis to execute atomic job lifecycle operations (put, pop, heartbeat, complete, fail, etc.). This language-agnostic core makes the queue engine reusable from any language that can call Redis EVALSHA. The Ruby gem provides two worker types (Forking and Serial), pluggable job reservers (Ordered, RoundRobin, ShuffledRoundRobin), and a middleware stack for cross-cutting concerns like timeout enforcement, retry logic, exception notifications (Sentry), and memory monitoring. The codebase demonstrates good engineering practices: clear separation of concerns, well-structured middleware pattern, comprehensive test coverage (RSpec with integration and unit tests), and a focus on operational metrics (histograms, fail/retry counts). However, the frontend assets (Bootstrap 2.0.2, outdated jQuery plugins) and some dependencies (Thin, legacy Redis compatibility shims) show technical drift. The project receives active maintenance (recent compatibility updates for Redis 6+ and Valkey 8) but retains some technical debt.
The LLM identified 6 files worth highlighting for reuse:
Implements a generic retry mechanism for job execution failures using the around_perform hook. Configurable max retries and backoff strategy. Self-contained and reusableβextract it to any Redis-backed job system that supports middleware hooks.
Automatically requeues jobs that raise exceptions, bypassing the failure path. Clean implementation of the around_perform contract. Reusable as a generic 'retry-forever' middleware.
Enforces job execution timeouts using Ruby's Timeout module. Signals a configurable exception on timeout. The middleware pattern isolates timeout logic cleanly, making it reusable outside of Qless.
Pluggable job reservation strategy that cycles through queues in a round-robin order. Implements a simple `reserve(queues)` interface. Could be extracted as a reusable strategy for any queue system with multiple queues.
Provides a standardized way to format failure information: truncates long messages, replaces absolute paths with relative ones, and structures the error output. Reusable for any system that needs consistent failure logging.
Wrapper for executing Lua scripts in Redis with automatic SHA caching and reloading on NOSCRIPT errors. Supports plugin scripts via LuaPlugin. This pattern is reusable for any Redis-backed application that uses Lua scripting for atomicity.