Fix not possible to create tasks if metrics were enabled

This commit is contained in:
kolaente 2020-10-20 20:28:44 +02:00
parent 6270bb3e77
commit 707709deb1
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -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"}
} }