Skip to content

Commit 33edc97

Browse files
Sergei TsoganovSergei Tsoganov
authored andcommitted
Added default window minutes for validators
1 parent 94ba2aa commit 33edc97

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/validators/base_task_validator.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# app/validators/base_task_validator.rb
22
class BaseTaskValidator
3+
DEFAULT_WINDOW_MINUTES = 120
4+
35
def initialize(attempt:, config:, inputs:, token: nil)
46
@attempt = attempt
57
@config = config
@@ -35,8 +37,8 @@ def parse_time(val)
3537
end
3638

3739
def compute_window_and_cutoff
38-
window = (@config['window_minutes'] || 15).to_i
39-
window = 15 if window <= 0
40+
window = (@config['window_minutes'] || DEFAULT_WINDOW_MINUTES).to_i
41+
window = DEFAULT_WINDOW_MINUTES if window <= 0
4042
cutoff = Time.current - window.minutes
4143

4244
[window, cutoff]

0 commit comments

Comments
 (0)