Class: RailsErrorDashboard::Commands::FindOrIncrementError
- Inherits:
-
Object
- Object
- RailsErrorDashboard::Commands::FindOrIncrementError
- Defined in:
- lib/rails_error_dashboard/commands/find_or_increment_error.rb
Overview
Command: Find an existing error by hash or create a new one Uses pessimistic locking to prevent race conditions in multi-app scenarios.
Search order:
-
Unresolved errors with same hash within 24 hours → increment occurrence count
-
Resolved/wont_fix errors with same hash (any age) → reopen and increment
-
No match → create new error record
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(error_hash, attributes = {}) ⇒ FindOrIncrementError
constructor
A new instance of FindOrIncrementError.
Constructor Details
#initialize(error_hash, attributes = {}) ⇒ FindOrIncrementError
Returns a new instance of FindOrIncrementError.
17 18 19 20 |
# File 'lib/rails_error_dashboard/commands/find_or_increment_error.rb', line 17 def initialize(error_hash, attributes = {}) @error_hash = error_hash @attributes = attributes end |
Class Method Details
.call(error_hash, attributes = {}) ⇒ Object
13 14 15 |
# File 'lib/rails_error_dashboard/commands/find_or_increment_error.rb', line 13 def self.call(error_hash, attributes = {}) new(error_hash, attributes).call end |
Instance Method Details
#call ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rails_error_dashboard/commands/find_or_increment_error.rb', line 22 def call # Priority 1: Find unresolved match (existing behavior) existing = find_unresolved return increment_existing(existing) if existing # Priority 2: Find resolved/wont_fix match → reopen resolved = find_resolved return reopen_existing(resolved) if resolved # Priority 3: Create new record create_new_or_retry end |