mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-31 02:51:51 -07:00
## What changed? - When checking waiters, only check waiter with higher or equal priority. - Allow specifying priority in TryAcquire() ## Why? - If there's all waiters have lower priority, we don't really need to create a new waiter and later unblock it. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [x] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
12 lines
200 B
Go
12 lines
200 B
Go
package locks
|
|
|
|
import "context"
|
|
|
|
type (
|
|
PrioritySemaphore interface {
|
|
Acquire(ctx context.Context, priority Priority, n int) error
|
|
TryAcquire(priority Priority, n int) bool
|
|
Release(n int)
|
|
}
|
|
)
|