@@ -146,10 +146,9 @@ ENABLE_SECOND_PRECISION_SCHEDULE=false |
||
146 | 146 |
# at the expense of time accuracy. |
147 | 147 |
#SCHEDULER_FREQUENCY=0.3 |
148 | 148 |
|
149 |
-# Specify whether events ages should be checked daily or frequently. |
|
150 |
-# A value of "normal" checks each day at midnight, while a value of |
|
151 |
-# "frequent" adds an option to keep events for 90 seconds and checks every 3 minutes |
|
152 |
-SCHEDULER_EXPIRATION_CHECK=normal |
|
149 |
+# Specify the frequency with which the scheduler checks for event expiration. |
|
150 |
+# You can use `m` for minutes, `h` for hours, and `d` for days. |
|
151 |
+EVENT_EXPIRATION_CHECK="3h" |
|
153 | 152 |
|
154 | 153 |
# Use Graphviz for generating diagrams instead of using Google Chart |
155 | 154 |
# Tools. Specify a dot(1) command path built with SVG support |
@@ -22,9 +22,6 @@ class Agent < ActiveRecord::Base |
||
22 | 22 |
midnight 1am 2am 3am 4am 5am 6am 7am 8am 9am 10am 11am noon 1pm 2pm 3pm 4pm 5pm 6pm 7pm 8pm 9pm 10pm 11pm never] |
23 | 23 |
|
24 | 24 |
EVENT_RETENTION_SCHEDULES = [["Forever", 0], ["1 day", 1], *([2, 3, 4, 5, 7, 14, 21, 30, 45, 90, 180, 365].map {|n| ["#{n} days", n] })] |
25 |
- if ENV['SCHEDULER_EXPIRATION_CHECK'] == 'frequent' |
|
26 |
- EVENT_RETENTION_SCHEDULES.insert(1, ["A minute", 60]) |
|
27 |
- end |
|
28 | 25 |
|
29 | 26 |
attr_accessible :options, :memory, :name, :type, :schedule, :controller_ids, :control_target_ids, :disabled, :source_ids, :scenario_ids, :keep_events_for, :propagate_immediately, :drop_pending_events |
30 | 27 |
|
@@ -114,14 +114,8 @@ class HuginnScheduler |
||
114 | 114 |
end |
115 | 115 |
|
116 | 116 |
# Schedule event cleanup. |
117 |
- if ENV['SCHEDULER_EXPIRATION_CHECK'] == 'normal' |
|
118 |
- @rufus_scheduler.cron "0 0 * * * " + tzinfo_friendly_timezone do |
|
119 |
- cleanup_expired_events! |
|
120 |
- end |
|
121 |
- elsif ENV['SCHEDULER_EXPIRATION_CHECK'] == 'frequent' |
|
122 |
- @rufus_scheduler.every '3m' do |
|
123 |
- cleanup_expired_events! |
|
124 |
- end |
|
117 |
+ @rufus_scheduler.every ENV['EVENT_EXPIRATION_CHECK'] do |
|
118 |
+ cleanup_expired_events! |
|
125 | 119 |
end |
126 | 120 |
|
127 | 121 |
# Schedule failed job cleanup. |