From 3d13add291caa19c2abc839806278ad3a0acb9c4 Mon Sep 17 00:00:00 2001 From: TeoV Date: Mon, 22 Jul 2019 11:26:53 +0300 Subject: [PATCH] Send s.CGRID as parameter to go func and topup accounts from tutorial TP --- data/conf/samples/tutmongo/cgrates.json | 2 +- data/conf/samples/tutmysql/cgrates.json | 2 +- data/tariffplans/tutorial/ActionPlans.csv | 2 +- data/tariffplans/tutorial/Actions.csv | 3 +-- sessions/sessions.go | 8 ++++---- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/data/conf/samples/tutmongo/cgrates.json b/data/conf/samples/tutmongo/cgrates.json index ae0280593..7d51c33a4 100644 --- a/data/conf/samples/tutmongo/cgrates.json +++ b/data/conf/samples/tutmongo/cgrates.json @@ -121,7 +121,7 @@ "loaders": [ { "id": "CustomLoader", // identifier of the Loader - "enabled": true, // starts as service: . + "enabled": false, // starts as service: . "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 diff --git a/data/conf/samples/tutmysql/cgrates.json b/data/conf/samples/tutmysql/cgrates.json index cb6125280..b6342f6c9 100644 --- a/data/conf/samples/tutmysql/cgrates.json +++ b/data/conf/samples/tutmysql/cgrates.json @@ -72,7 +72,7 @@ "loaders": [ { "id": "CustomLoader", // identifier of the Loader - "enabled": true, // starts as service: . + "enabled": false, // starts as service: . "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 diff --git a/data/tariffplans/tutorial/ActionPlans.csv b/data/tariffplans/tutorial/ActionPlans.csv index e53e88030..b10e827b5 100644 --- a/data/tariffplans/tutorial/ActionPlans.csv +++ b/data/tariffplans/tutorial/ActionPlans.csv @@ -1,2 +1,2 @@ #Id,ActionsId,TimingId,Weight -AP_PACKAGE_10,ACT_BALANCE_RESET,*asap,10 \ No newline at end of file +AP_PACKAGE_10,ACT_TOPUP_RST_10,*asap,10 \ No newline at end of file diff --git a/data/tariffplans/tutorial/Actions.csv b/data/tariffplans/tutorial/Actions.csv index ba037d811..256e83424 100644 --- a/data/tariffplans/tutorial/Actions.csv +++ b/data/tariffplans/tutorial/Actions.csv @@ -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 \ No newline at end of file +ACT_LOG_WARNING,*log,,,,,,,,,,,,,false,false,10 \ No newline at end of file diff --git a/sessions/sessions.go b/sessions/sessions.go index 60dce7646..5b8956d39 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -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: