]> git.proxmox.com Git - proxmox-backup.git/commit
config/jobstate: replace Job:load with create_state_file
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 13 Aug 2020 12:30:19 +0000 (14:30 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 14 Aug 2020 04:38:02 +0000 (06:38 +0200)
commit93bb51fe7e008d0ee0470c53c821c80316841aa8
treec68c5847fd0af95a42e9b4529a066e77b2bbec6f
parent713b66b6ed45eb3888fcd6355055839f41f7d581
config/jobstate: replace Job:load with create_state_file

it really is not necessary, since the only time we are interested in
loading the state from the file is when we list it, and there
we use JobState::load directly to avoid the lock

we still need to create the file on syncjob creation though, so
that we have the correct time for the schedule

to do this we add a new create_state_file that overwrites it on creation
of a syncjob

for safety, we subtract 30 seconds from the in-memory state in case
the statefile is missing

since we call create_state_file from  proxmox-backup-api,
we have to chown the lock file after creating to the backup user,
else the sync job scheduling cannot aquire the lock

also we remove the lock file on statefile removal

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/api2/admin/sync.rs
src/api2/config/sync.rs
src/bin/proxmox-backup-proxy.rs
src/config/jobstate.rs