Skip to content

Commit

Permalink
check for borg>=1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
shivansh02 committed Jun 17, 2024
1 parent 60ef862 commit 277b9b9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/vorta/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from datetime import timedelta
from typing import Dict, NamedTuple, Optional, Tuple, Union

from packaging import version
from PyQt6 import QtCore, QtDBus
from PyQt6.QtCore import QTimer
from PyQt6.QtWidgets import QApplication
Expand Down Expand Up @@ -491,7 +492,7 @@ def post_backup_tasks(self, profile_id):
job = BorgCheckJob(msg['cmd'], msg, profile.repo.id)
self.app.jobs_manager.add_job(job)

compaction_cutoff = dt.now() - timedelta(weeks=7 * profile.compaction_weeks)
compaction_cutoff = dt.now() - timedelta(days=7 * profile.compaction_weeks)
recent_compactions = (
EventLogModel.select()
.where(
Expand All @@ -502,7 +503,11 @@ def post_backup_tasks(self, profile_id):
.count()
)

if profile.compaction_on and recent_compactions == 0 and borg_compat.version >= 1.2:
if (
profile.compaction_on
and recent_compactions == 0
and version.parse(borg_compat.version) >= version.parse("1.2")
):
msg = BorgCompactJob.prepare(profile)
if msg['ok']:
job = BorgCompactJob(msg['cmd'], msg, profile.repo.id)
Expand Down

0 comments on commit 277b9b9

Please sign in to comment.