Class: QueuePulse::Source
- Inherits:
-
Object
- Object
- QueuePulse::Source
- Defined in:
- lib/queue_pulse/source.rb,
lib/queue_pulse/source/solid_queue.rb
Overview
A Source abstracts every read of Solid Queue's tables. Production uses Source::SolidQueue; tests use Source::Fake. Checks depend only on this interface, so the core logic is verifiable without a real database.
Defined Under Namespace
Classes: ClaimedRecord, FailedRecord, Fake, QueueStat, SolidQueue
Instance Method Summary collapse
-
#available? ⇒ Boolean
Is the Solid Queue schema present and readable? When false, all checks are skipped (the app may simply not have Solid Queue set up yet).
-
#failed_count_since(_since_id) ⇒ Integer
Number of failed executions with id > since_id.
-
#failed_executions_since(_since_id, limit:) ⇒ Array<FailedRecord>
Failed executions with id > since_id.
-
#live_process_count(heartbeat_within:) ⇒ Object
Number of processes whose heartbeat is within
heartbeat_withinseconds. -
#max_failed_execution_id ⇒ Integer?
The largest failed-execution id currently present.
- #now ⇒ Object
-
#queue_stats ⇒ Array<QueueStat>
Per-queue ready depth and oldest enqueue time.
-
#stuck_claimed_executions(older_than:) ⇒ Array<ClaimedRecord>
Jobs claimed before (now - older_than secs).
-
#total_process_count ⇒ Object
Total processes ever registered (used to distinguish "never started" from "all died").
Instance Method Details
#available? ⇒ Boolean
Is the Solid Queue schema present and readable? When false, all checks are skipped (the app may simply not have Solid Queue set up yet).
15 16 17 |
# File 'lib/queue_pulse/source.rb', line 15 def available? raise NotImplementedError end |
#failed_count_since(_since_id) ⇒ Integer
Returns number of failed executions with id > since_id.
34 35 36 |
# File 'lib/queue_pulse/source.rb', line 34 def failed_count_since(_since_id) raise NotImplementedError end |
#failed_executions_since(_since_id, limit:) ⇒ Array<FailedRecord>
Returns failed executions with id > since_id.
24 25 26 |
# File 'lib/queue_pulse/source.rb', line 24 def failed_executions_since(_since_id, limit:) raise NotImplementedError end |
#live_process_count(heartbeat_within:) ⇒ Object
Number of processes whose heartbeat is within heartbeat_within seconds.
49 50 51 |
# File 'lib/queue_pulse/source.rb', line 49 def live_process_count(heartbeat_within:) raise NotImplementedError end |
#max_failed_execution_id ⇒ Integer?
Returns the largest failed-execution id currently present.
29 30 31 |
# File 'lib/queue_pulse/source.rb', line 29 def max_failed_execution_id raise NotImplementedError end |
#now ⇒ Object
19 20 21 |
# File 'lib/queue_pulse/source.rb', line 19 def now Time.now end |
#queue_stats ⇒ Array<QueueStat>
Returns per-queue ready depth and oldest enqueue time.
39 40 41 |
# File 'lib/queue_pulse/source.rb', line 39 def queue_stats raise NotImplementedError end |
#stuck_claimed_executions(older_than:) ⇒ Array<ClaimedRecord>
Returns jobs claimed before (now - older_than secs).
44 45 46 |
# File 'lib/queue_pulse/source.rb', line 44 def stuck_claimed_executions(older_than:) raise NotImplementedError end |
#total_process_count ⇒ Object
Total processes ever registered (used to distinguish "never started" from "all died").
55 56 57 |
# File 'lib/queue_pulse/source.rb', line 55 def total_process_count raise NotImplementedError end |