Ability to enable/disable locks
This commit is contained in:
@@ -116,10 +116,12 @@ type Plugin struct {
|
||||
func GetJavaStatus(host string, port uint16, enableQuery bool) (*JavaStatusResponse, time.Duration, error) {
|
||||
cacheKey := fmt.Sprintf("java:%v-%s-%d", enableQuery, host, port)
|
||||
|
||||
mutex := r.NewMutex(fmt.Sprintf("java-lock:%v-%s-%d", enableQuery, host, port))
|
||||
mutex.Lock()
|
||||
if conf.Cache.EnableLocks {
|
||||
mutex := r.NewMutex(fmt.Sprintf("java-lock:%v-%s-%d", enableQuery, host, port))
|
||||
mutex.Lock()
|
||||
|
||||
defer mutex.Unlock()
|
||||
defer mutex.Unlock()
|
||||
}
|
||||
|
||||
cache, ttl, err := r.Get(cacheKey)
|
||||
|
||||
@@ -154,10 +156,12 @@ func GetJavaStatus(host string, port uint16, enableQuery bool) (*JavaStatusRespo
|
||||
func GetBedrockStatus(host string, port uint16) (*BedrockStatusResponse, time.Duration, error) {
|
||||
cacheKey := fmt.Sprintf("bedrock:%s-%d", host, port)
|
||||
|
||||
mutex := r.NewMutex(fmt.Sprintf("bedrock-lock:%s-%d", host, port))
|
||||
mutex.Lock()
|
||||
if conf.Cache.EnableLocks {
|
||||
mutex := r.NewMutex(fmt.Sprintf("bedrock-lock:%s-%d", host, port))
|
||||
mutex.Lock()
|
||||
|
||||
defer mutex.Unlock()
|
||||
defer mutex.Unlock()
|
||||
}
|
||||
|
||||
cache, ttl, err := r.Get(cacheKey)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user