-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: multiple mutexes and semaphores
Fixes #5022 Fixes #11859 This is mostly backwards compatbile. It is minorly breaking only in as much as semaphore + mutex at the same time will now require both, whereas before it ignored the mutex. As a workflows users I would like to be able to use more than one sync option in a workflow or template. Added `mutexes` and `semaphores` to the `synchronization` block in workflow types as lists. Legacy `mutex` and `semaphore` kept in and continue to work (will be added to the mutexes/semaphores list) but marked for deprecation. Logic changed to acquire a full list of all synchronization items (`syncItem`) when `TryAcquire` and `Release` from sync manager. `TryAcquire` from sync_manager` calls a new `checkAcquire` method, whilst holding the sync_manager internal golang `sync.Mutex` to check if they are all acquirable before acquiring them. This honors priority. `TryAcquire` also returns the failed lock name in the case of failure to acquire to reduce the number of exported `package sync` methods and complexity outside of `sync`. The interface to the workflow status block has not changed. Reduced the exported types and methods from the sync module as far as possible (lower case instead of upper case). Removed the internal golang sync mutex from `PrioritySemaphore` as all methods are called from `sync_manager.go` when under it's own lock. The alternative was unnecessarily complicating the calls inside semaphore.go. This is faster, but less clean in case someone wants to reuse the PrioritySemaphore type. Renamed the manager in `sync_manager.go` where used: `cm`->`sm` and `concurrencyManager`->`syncManager`. New and updated unit tests. New and updated e2e smoke tests. Signed-off-by: Alan Clucas <[email protected]>
- Loading branch information
Showing
52 changed files
with
3,364 additions
and
1,169 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.