cloner: timer: grace interval
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
parent
cb0d8681ae
commit
0e1d535ba0
|
@ -54,8 +54,8 @@ class Cloner:
|
||||||
file_stamp = int(str_val)
|
file_stamp = int(str_val)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
log.warning(f"Interval file file is corrupted, keeping value as nothing happened")
|
log.warning(f"Interval file file is corrupted, keeping value as nothing happened")
|
||||||
# check time
|
# check time - 10 second grace period for delayed jobs
|
||||||
if time() > file_stamp + interval * 60:
|
if (time() + 10) > file_stamp + interval * 60:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ def test_check_interval(cloner_dir_struct: Path, monkeypatch):
|
||||||
|
|
||||||
# timestamp file in future -> no run
|
# timestamp file in future -> no run
|
||||||
timestamp_file.touch()
|
timestamp_file.touch()
|
||||||
timestamp_file.write_text(str(int(mock_time() + 1)))
|
timestamp_file.write_text(str(int(mock_time() + 11)))
|
||||||
assert not cloner.check_interval()
|
assert not cloner.check_interval()
|
||||||
|
|
||||||
# timestamp in history, but run everytime is set >> RUN
|
# timestamp in history, but run everytime is set >> RUN
|
||||||
|
|
Loading…
Reference in New Issue
Block a user