From 7fabed224a127763d074a4eb9373d43d1b782e42 Mon Sep 17 00:00:00 2001 From: Rafael Soares Date: Fri, 8 Oct 2021 14:40:28 -0300 Subject: [PATCH 1/3] ignore throttled channel validation on retryCalls ivr cron --- core/tasks/ivr/cron.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tasks/ivr/cron.go b/core/tasks/ivr/cron.go index 1340ff5e0..47d8c0d10 100644 --- a/core/tasks/ivr/cron.go +++ b/core/tasks/ivr/cron.go @@ -67,11 +67,11 @@ func retryCalls(ctx context.Context, rt *runtime.Runtime, lockName string, lockV log = log.WithField("connection_id", conn.ID()) // if the channel for this connection is throttled, move on - if throttledChannels[conn.ChannelID()] { + /*if throttledChannels[conn.ChannelID()] { conn.MarkThrottled(ctx, rt.DB, time.Now()) log.WithField("channel_id", conn.ChannelID()).Info("skipping connection, throttled") continue - } + }*/ // load the org for this connection oa, err := models.GetOrgAssets(ctx, rt, conn.OrgID()) From 563b470bc0ed1e3e7076d19b4ac978981783181f Mon Sep 17 00:00:00 2001 From: Rafael Soares Date: Fri, 8 Oct 2021 17:14:31 -0300 Subject: [PATCH 2/3] increate expiration time of ivr cron contexts --- core/tasks/ivr/cron.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/tasks/ivr/cron.go b/core/tasks/ivr/cron.go index 47d8c0d10..b83c8c388 100644 --- a/core/tasks/ivr/cron.go +++ b/core/tasks/ivr/cron.go @@ -29,7 +29,7 @@ func init() { func StartIVRCron(rt *runtime.Runtime, wg *sync.WaitGroup, quit chan bool) error { cron.StartCron(quit, rt.RP, retryIVRLock, time.Minute, func(lockName string, lockValue string) error { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5) + ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10) defer cancel() return retryCalls(ctx, rt, retryIVRLock, lockValue) }, @@ -37,7 +37,7 @@ func StartIVRCron(rt *runtime.Runtime, wg *sync.WaitGroup, quit chan bool) error cron.StartCron(quit, rt.RP, expireIVRLock, time.Minute, func(lockName string, lockValue string) error { - ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5) + ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10) defer cancel() return expireCalls(ctx, rt, expireIVRLock, lockValue) }, @@ -52,7 +52,7 @@ func retryCalls(ctx context.Context, rt *runtime.Runtime, lockName string, lockV start := time.Now() // find all calls that need restarting - ctx, cancel := context.WithTimeout(ctx, time.Minute*5) + ctx, cancel := context.WithTimeout(ctx, time.Minute*10) defer cancel() conns, err := models.LoadChannelConnectionsToRetry(ctx, rt.DB, 100) @@ -118,7 +118,7 @@ func expireCalls(ctx context.Context, rt *runtime.Runtime, lockName string, lock log := logrus.WithField("comp", "ivr_cron_expirer").WithField("lock", lockValue) start := time.Now() - ctx, cancel := context.WithTimeout(ctx, time.Minute*5) + ctx, cancel := context.WithTimeout(ctx, time.Minute*10) defer cancel() // select our expired runs From 0789b0c9978e9d3ae64a308be5bbdb96daef81de Mon Sep 17 00:00:00 2001 From: Rafael Soares Date: Fri, 8 Oct 2021 17:17:15 -0300 Subject: [PATCH 3/3] increase connection limit for each retryCall on ivr cron --- core/tasks/ivr/cron.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tasks/ivr/cron.go b/core/tasks/ivr/cron.go index b83c8c388..e1657f5f5 100644 --- a/core/tasks/ivr/cron.go +++ b/core/tasks/ivr/cron.go @@ -55,7 +55,7 @@ func retryCalls(ctx context.Context, rt *runtime.Runtime, lockName string, lockV ctx, cancel := context.WithTimeout(ctx, time.Minute*10) defer cancel() - conns, err := models.LoadChannelConnectionsToRetry(ctx, rt.DB, 100) + conns, err := models.LoadChannelConnectionsToRetry(ctx, rt.DB, 200) if err != nil { return errors.Wrapf(err, "error loading connections to retry") }