Class: ExceptionHunter::ErrorReaper

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_hunter/error_reaper.rb

Overview

Class in charge of disposing of stale errors as specified in the Config.

Class Method Summary collapse

Class Method Details

.purge(stale_time: Config.errors_stale_time)

This method returns an undefined value.

Destroys all stale errors.

Examples:

ErrorReaper.purge(stale_time: 30.days)

Parameters:

  • stale_time (Numeric) (defaults to: Config.errors_stale_time)

    considered when destroying errors



12
13
14
15
16
17
# File 'lib/exception_hunter/error_reaper.rb', line 12

def purge(stale_time: Config.errors_stale_time)
  ActiveRecord::Base.transaction do
    Error.with_occurrences_before(Date.today - stale_time).destroy_all
    ErrorGroup.without_errors.destroy_all
  end
end