Skip to content

Fix potential race condition#111

Merged
iaindillingham merged 1 commit intomainfrom
iaindillingham/race-condition
Mar 5, 2025
Merged

Fix potential race condition#111
iaindillingham merged 1 commit intomainfrom
iaindillingham/race-condition

Conversation

@iaindillingham
Copy link
Copy Markdown
Member

If two commits are merged to main, each will trigger a separate run of the CI workflow. If, for some reason, the later commit's run completes first, then the later commit will be tagged with the next version number. The earlier commit, whose run completes second, will also be tagged with the next version number, but the earlier commit's version number will be greater than the later commit's version number, which is very confusing.

This is known as a race condition. To prevent it, we should ensure that runs are executed in sequence. To do so, we should set the workflow's concurrency property. See:

If two commits are merged to `main`, each will trigger a separate run of
the CI workflow. If, for some reason, the later commit's run completes
first, then the later commit will be tagged with the next version
number. The earlier commit, whose run completes second, will also be
tagged with the next version number, but the earlier commit's version
number will be greater than the later commit's version number, which is
very confusing.

This is known as a _race condition_. To prevent it, we should ensure
that runs are executed in sequence. To do so, we should set [the
workflow's `concurrency` property][1]. See:

* opensafely-actions/kaplan-meier-function#25
* opensafely-actions/kaplan-meier-function#27

[1]: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
@iaindillingham iaindillingham merged commit d5015c6 into main Mar 5, 2025
@iaindillingham iaindillingham deleted the iaindillingham/race-condition branch March 5, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant