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 May 12, 2024
1 parent fd96b37 commit 3b5bcbb
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 @@ -490,7 +491,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 @@ -501,7 +502,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 3b5bcbb

Please sign in to comment.