Skip to content

Commit

Permalink
Merge pull request #68 from flyingcircusio/running-backup-sla
Browse files Browse the repository at this point in the history
Ignore currently running backup for SLA calculation
  • Loading branch information
ctheune authored Jun 12, 2024
2 parents 752c76f + 9c28f4f commit b92cda2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.d/20240612_121019_jb_running_backup_sla.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. A new scriv changelog fragment.
- Ignore currently running backups for SLA calculation
2 changes: 0 additions & 2 deletions src/backy/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ def sla_overdue(self) -> int:
"""Amount of time the SLA is currently overdue."""
if not self.backup.clean_history:
return 0
if self.status.startswith("running"):
return 0
age = backy.utils.now() - self.backup.clean_history[-1].timestamp
max_age = min(x["interval"] for x in self.schedule.schedule.values())
if age > max_age * 1.5:
Expand Down
6 changes: 6 additions & 0 deletions src/backy/tests/test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ def test_sla_over_time(daemon, clock, tmp_path, log):
job.backup.scan()
assert job.sla is False

# a running backup does not influence this.
job.update_status("running (slow)")
r = Revision.create(job.backup, {"daily"}, log)
r.write_info()
assert job.sla is False


def test_incomplete_revs_dont_count_for_sla(daemon, clock, tmp_path, log):
job = daemon.jobs["test01"]
Expand Down

0 comments on commit b92cda2

Please sign in to comment.