Send s.CGRID as parameter to go func and topup accounts from tutorial TP

This commit is contained in:
TeoV
2019-07-22 11:26:53 +03:00
committed by Dan Christian Bogos
parent 1c0f94cef0
commit 3d13add291
5 changed files with 8 additions and 9 deletions

View File

@@ -121,7 +121,7 @@
"loaders": [
{
"id": "CustomLoader", // identifier of the Loader
"enabled": true, // starts as service: <true|false>.
"enabled": false, // starts as service: <true|false>.
"dry_run": false, // do not send the CDRs to CDRS, just parse them
"run_delay": 0, // sleep interval in seconds between consecutive runs, 0 to use automation via inotify
"lock_filename": ".cgr.lock", // Filename containing concurrency lock in case of delayed processing

View File

@@ -72,7 +72,7 @@
"loaders": [
{
"id": "CustomLoader", // identifier of the Loader
"enabled": true, // starts as service: <true|false>.
"enabled": false, // starts as service: <true|false>.
"dry_run": false, // do not send the CDRs to CDRS, just parse them
"run_delay": 0, // sleep interval in seconds between consecutive runs, 0 to use automation via inotify
"lock_filename": ".cgr.lock", // Filename containing concurrency lock in case of delayed processing

View File

@@ -1,2 +1,2 @@
#Id,ActionsId,TimingId,Weight
AP_PACKAGE_10,ACT_BALANCE_RESET,*asap,10
AP_PACKAGE_10,ACT_TOPUP_RST_10,*asap,10
1 #Id ActionsId TimingId Weight
2 AP_PACKAGE_10 ACT_BALANCE_RESET ACT_TOPUP_RST_10 *asap 10

View File

@@ -1,4 +1,3 @@
#ActionsId[0],Action[1],ExtraParameters[2],Filter[3],BalanceId[4],BalanceType[5],Categories[6],DestinationIds[7],RatingSubject[8],SharedGroup[9],ExpiryTime[10],TimingIds[11],Units[12],BalanceWeight[13],BalanceBlocker[14],BalanceDisabled[15],Weight[16]
ACT_TOPUP_RST_10,*topup_reset,,,test,*monetary,,*any,,,*unlimited,,10,10,false,false,10
ACT_LOG_WARNING,*log,,,,,,,,,,,,,false,false,10
ACT_BALANCE_RESET,*set_balance,,,test,*monetary,,,,,,,,,true,false,10
ACT_LOG_WARNING,*log,,,,,,,,,,,,,false,false,10
1 #ActionsId[0] Action[1] ExtraParameters[2] Filter[3] BalanceId[4] BalanceType[5] Categories[6] DestinationIds[7] RatingSubject[8] SharedGroup[9] ExpiryTime[10] TimingIds[11] Units[12] BalanceWeight[13] BalanceBlocker[14] BalanceDisabled[15] Weight[16]
2 ACT_TOPUP_RST_10 *topup_reset test *monetary *any *unlimited 10 10 false false 10
3 ACT_LOG_WARNING *log false false 10
ACT_BALANCE_RESET *set_balance test *monetary true false 10

View File

@@ -552,7 +552,7 @@ func (sS *SessionS) debitLoopSession(s *Session, sRunIdx int,
}
return
} else if maxDebit < dbtIvl {
go func() { // schedule sending disconnect command
go func(cgrID string) { // schedule sending disconnect command
select {
case <-s.debitStop: // call was disconnected already
return
@@ -564,13 +564,13 @@ func (sS *SessionS) debitLoopSession(s *Session, sRunIdx int,
}
utils.Logger.Warning(
fmt.Sprintf("<%s> could not command disconnect session: %s, error: %s",
utils.SessionS, s.CGRid(), err.Error()))
utils.SessionS, cgrID, err.Error()))
}
if err = sS.forceSTerminate(s, 0, nil); err != nil {
utils.Logger.Warning(fmt.Sprintf("<%s> failed force-terminating session: <%s>, err: <%s>", utils.SessionS, s.CGRid(), err))
utils.Logger.Warning(fmt.Sprintf("<%s> failed force-terminating session: <%s>, err: <%s>", utils.SessionS, cgrID, err))
}
}
}()
}(s.CGRid())
}
select {
case <-s.debitStop: