Fix not possible to create tasks if metrics were enabled
(cherry picked from commit 707709deb1
)
This commit is contained in:
parent
2b8c9c698d
commit
05251b85f0
1 changed files with 2 additions and 10 deletions
|
@ -72,11 +72,7 @@ func (s *Storage) IncrBy(key string, update int64) (err error) {
|
||||||
s.mutex.Lock()
|
s.mutex.Lock()
|
||||||
defer s.mutex.Unlock()
|
defer s.mutex.Unlock()
|
||||||
|
|
||||||
v, err := s.Get(key)
|
val, is := s.store[key].(int64)
|
||||||
if err != nil && !e.IsErrValueNotFoundForKey(err) {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
val, is := v.(int64)
|
|
||||||
if !is {
|
if !is {
|
||||||
return &e.ErrValueHasWrongType{Key: key, ExpectedValue: "int64"}
|
return &e.ErrValueHasWrongType{Key: key, ExpectedValue: "int64"}
|
||||||
}
|
}
|
||||||
|
@ -90,11 +86,7 @@ func (s *Storage) DecrBy(key string, update int64) (err error) {
|
||||||
s.mutex.Lock()
|
s.mutex.Lock()
|
||||||
defer s.mutex.Unlock()
|
defer s.mutex.Unlock()
|
||||||
|
|
||||||
v, err := s.Get(key)
|
val, is := s.store[key].(int64)
|
||||||
if err != nil && !e.IsErrValueNotFoundForKey(err) {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
val, is := v.(int64)
|
|
||||||
if !is {
|
if !is {
|
||||||
return &e.ErrValueHasWrongType{Key: key, ExpectedValue: "int64"}
|
return &e.ErrValueHasWrongType{Key: key, ExpectedValue: "int64"}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue