Merge pull request 'Fix lockfile' (#114) from fix-lock into go-sbot-service
Some checks reported errors
continuous-integration/drone/pr Build was killed

Reviewed-on: #114
This commit is contained in:
2022-05-20 14:33:18 +00:00

View File

@ -132,7 +132,10 @@ pub fn save_peach_config_to_disc(
peach_config: HashMap<String, String>,
) -> Result<HashMap<String, String>, PeachError> {
// use a file lock to avoid race conditions while saving config
let mut lock = LockFile::open(&*LOCK_FILE_PATH)?;
let mut lock = LockFile::open(&*LOCK_FILE_PATH).map_err(|source| PeachError::Read {
source,
path: LOCK_FILE_PATH.to_string(),
})?;
lock.lock()?;
// first convert Hashmap to BTreeMap (so that keys are saved in deterministic alphabetical order)