Skip to content

Commit 00901aa

Browse files
authored
unlock stale locks before forgetting or pruning
This is safe to do because only stale locks are removed. See restic/restic#2736 and https://github.com/restic/restic/blob/master/internal/restic/lock.go By default only locks older than 30 minutes or when the pid is no longer found on the same machine, are removed. Locks are refreshed every 5 minutes when doing operations.
1 parent 11815f0 commit 00901aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/restic_compose_backup/restic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ def is_initialized(repository: str) -> bool:
7777

7878

7979
def forget(repository: str, daily: str, weekly: str, monthly: str, yearly: str):
80+
commands.run(restic(repository, [
81+
'unlock'
82+
])
8083
return commands.run(restic(repository, [
8184
'forget',
8285
'--group-by',
@@ -93,6 +96,9 @@ def forget(repository: str, daily: str, weekly: str, monthly: str, yearly: str):
9396

9497

9598
def prune(repository: str):
99+
commands.run(restic(repository, [
100+
'unlock'
101+
])
96102
return commands.run(restic(repository, [
97103
'prune',
98104
]))

0 commit comments

Comments
 (0)