Storage.GetActions using GetCloned

This commit is contained in:
DanB
2016-11-25 20:24:00 +01:00
parent 309878d418
commit 62f4f14d55
3 changed files with 18 additions and 9 deletions

View File

@@ -563,11 +563,14 @@ func (ms *MapStorage) GetActions(key string, skipCache bool, transactionID strin
cCommit := cacheCommit(transactionID)
key = utils.ACTION_PREFIX + key
if !skipCache {
if x, ok := cache.Get(key); ok {
if x != nil {
return x.(Actions), nil
if x, err := cache.GetCloned(key); err != nil {
if err.Error() != utils.ItemNotFound {
return nil, err
}
} else if x == nil {
return nil, utils.ErrNotFound
} else {
return x.(Actions), nil
}
}
if values, ok := ms.dict[key]; ok {

View File

@@ -896,11 +896,14 @@ func (ms *MongoStorage) UpdateReverseDestination(oldDest, newDest *Destination,
func (ms *MongoStorage) GetActions(key string, skipCache bool, transactionID string) (as Actions, err error) {
if !skipCache {
if x, ok := cache.Get(utils.ACTION_PREFIX + key); ok {
if x != nil {
return x.(Actions), nil
if x, err := cache.GetCloned(utils.ACTION_PREFIX + key); err != nil {
if err.Error() != utils.ItemNotFound {
return nil, err
}
} else if x == nil {
return nil, utils.ErrNotFound
} else {
return x.(Actions), nil
}
}
var result struct {

View File

@@ -572,11 +572,14 @@ func (rs *RedisStorage) UpdateReverseDestination(oldDest, newDest *Destination,
func (rs *RedisStorage) GetActions(key string, skipCache bool, transactionID string) (as Actions, err error) {
key = utils.ACTION_PREFIX + key
if !skipCache {
if x, ok := cache.Get(key); ok {
if x != nil {
return x.(Actions), nil
if x, err := cache.GetCloned(key); err != nil {
if err.Error() != utils.ItemNotFound {
return nil, err
}
} else if x == nil {
return nil, utils.ErrNotFound
} else {
return x.(Actions), nil
}
}
var values []byte