forked from lightninglabs/pool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auctioneer test: synchronize updates to auction state
This commit fixes a flake that happened because the state read from the stateTransitions channel wasn't synchronized with the state variable. What could happen was for the new state to be sent on the stateTransitions channel, but before the mutex had been obtained and the state variable was updated, the test would carry on assuming the new state was set in the DB. We fix this by observing there are really two cases of state access that can be happenng concurrently when trying to read the current state: 1. There are no other state access requestes, we get the semaphore and return the current state. 2. There is a pending state transition, so the semaphore is not free. In this case we fetch the current state from the holder of the semaphore.
- Loading branch information
Showing
1 changed file
with
56 additions
and
10 deletions.
There are no files selected for viewing
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