From 2d08f0a31e4ac8a17f7796a7cf7102c15b9ab22a Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Sun, 4 Aug 2013 22:32:11 +0300 Subject: [PATCH] set -1 cost on error --- engine/calldesc.go | 2 +- engine/storage_mongo.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/calldesc.go b/engine/calldesc.go index 5d1960e9d..7995d0965 100644 --- a/engine/calldesc.go +++ b/engine/calldesc.go @@ -266,7 +266,7 @@ func (cd *CallDescriptor) GetCost() (*CallCost, error) { destPrefix, err := cd.LoadActivationPeriods() if err != nil { Logger.Err(fmt.Sprintf("error getting cost for key %v: %v", cd.GetUserBalanceKey(), err)) - return &CallCost{}, err + return &CallCost{Cost: -1}, err } timespans := cd.splitInTimeSpans(nil) cost := 0.0 diff --git a/engine/storage_mongo.go b/engine/storage_mongo.go index 0c08d75bf..f75b6a971 100644 --- a/engine/storage_mongo.go +++ b/engine/storage_mongo.go @@ -134,7 +134,7 @@ func (ms *MongoStorage) GetRatingProfile(key string) (rp *RatingProfile, err err func (ms *MongoStorage) SetRatingProfile(rp *RatingProfile) error { if historyScribe != nil { response := 0 - go historyScribe.Record(&history.Record{RATING_PROFILE_PREFIX + rp.Id, rp}, &response) + historyScribe.Record(&history.Record{RATING_PROFILE_PREFIX + rp.Id, rp}, &response) } return ms.db.C("ratingprofiles").Insert(rp) } @@ -151,7 +151,7 @@ func (ms *MongoStorage) GetDestination(key string) (result *Destination, err err func (ms *MongoStorage) SetDestination(dest *Destination) error { if historyScribe != nil { response := 0 - go historyScribe.Record(&history.Record{DESTINATION_PREFIX + dest.Id, dest}, &response) + historyScribe.Record(&history.Record{DESTINATION_PREFIX + dest.Id, dest}, &response) } return ms.db.C("destinations").Insert(dest) }