Skip to content

Lock example_status_persistence_file to prevent race conditions

gitlab-qa-bot requested to merge github/fork/brigade/lock-example-status into master

Created by: Empact

This introduces file locking to ExampleStatusPersister#persist to avoid a race condition where parallel or unrelated spec runs race to update the same file:

  • read 1
  • read 2
  • write 1
  • write 2 - write 1 is lost

Because we need to read and write the file under the same lock, I inline #write into #persist so that dumped_statuses is called after the file is opened/locked.

Merge request reports