Class: EventMeter::AutoCleanup
- Inherits:
-
Object
- Object
- EventMeter::AutoCleanup
- Defined in:
- lib/event_meter/auto_cleanup.rb
Constant Summary collapse
- WATERMARK_KEY_SUFFIX =
"auto_cleanup:history:last_run"
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#rollup_storage ⇒ Object
readonly
Returns the value of attribute rollup_storage.
Instance Method Summary collapse
-
#initialize(configuration:, rollup_storage:) ⇒ AutoCleanup
constructor
A new instance of AutoCleanup.
- #run ⇒ Object
Constructor Details
#initialize(configuration:, rollup_storage:) ⇒ AutoCleanup
Returns a new instance of AutoCleanup.
9 10 11 12 |
# File 'lib/event_meter/auto_cleanup.rb', line 9 def initialize(configuration:, rollup_storage:) @configuration = configuration @rollup_storage = rollup_storage end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
7 8 9 |
# File 'lib/event_meter/auto_cleanup.rb', line 7 def configuration @configuration end |
#rollup_storage ⇒ Object (readonly)
Returns the value of attribute rollup_storage.
7 8 9 |
# File 'lib/event_meter/auto_cleanup.rb', line 7 def rollup_storage @rollup_storage end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/event_meter/auto_cleanup.rb', line 14 def run return false unless configuration.auto_cleanup_history return false unless rollup_storage.respond_to?(:cleanup_history) with_cleanup_lock { cleanup_if_due } rescue StandardError => error report_error(error) false end |