Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanServerList was modifying the map without grabbing any lock at all. Change how the lock is used in this code. Grab the lock only in exposed methods, as the others are only called once from the exposed ones. And use a single Mutex instead of a RWMutex, as both exposed methods do writes. Previously, AddOrUpdateServer would first grab a write lock and then grab some read locks. However, that's wasteful and can lead to subtle inconsistencies and bugs. Grab the same lock throughout the func. Fixes TykTechnologies#1216.
- Loading branch information