Very old lock and concerns about restic unlock

Server is normally in append-only mode, when doing restic forget (on non-append-only), I got:

Fatal: unable to create lock in backend: repository is already locked by PID 19815 on backup by username (UID 1000, GID 1000)
lock was created at 2020-04-13 23:00:02 (1438h10m34.797376502s ago)

The backup system does hourly backups with cron, some of them may have been interrupted by sleep/shutdowns.

Is there any way to prevent this from happening? Running restic unlock sounds like avoiding locks (and creating a catastrophic situation), when forget is running on cron.

I’ve struggled with restic locks myself. Seems like the lock needs to work like DHCP lease. By that I mean the lock has a lifetime and will expire if not renewed. Other info about the lock like creation time, expiration time, renewal count could be useful. Maybe the lock lifetime could be programable. IDK.

My first idea was to restic unlock --max-age 1d (if it runs hourly, after 1d something probably didn’t work well).

DHCP lease-like behaviour sounds like a reasonable idea. I have nothing else to really say, other than:
Related: #2214 (not with locks, but wait for lock to be released)