Merge pull request #652 from alin104n/tmp

Mongo counter fix
This commit is contained in:
Dan Christian Bogos
2017-03-20 17:56:14 +01:00
committed by GitHub
3 changed files with 9 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ import (
"fmt"
"io/ioutil"
"strings"
"time"
"github.com/cgrates/cgrates/cache"
"github.com/cgrates/cgrates/config"
@@ -112,7 +113,7 @@ func NewMongoStorage(host, port, db, user, pass, storageType string, cdrsIndexes
return nil, err
}
}
ms.cnter = utils.NewCounterGen(1000)
ms.cnter = utils.NewCounterGen(time.Now().UnixNano(), 0)
return
}

View File

@@ -883,7 +883,7 @@ func (ms *MongoStorage) GetSMCosts(cgrid, runid, originHost, originIDPrefix stri
func (ms *MongoStorage) SetCDR(cdr *CDR, allowUpdate bool) (err error) {
if cdr.OrderID == 0 {
cdr.OrderID = time.Now().UnixNano() + ms.cnter.Gen()
cdr.OrderID = ms.cnter.Gen()
}
session, col := ms.conn(utils.TBL_CDRS)
defer session.Close()