Skip to content

Commit

Permalink
Merge pull request #52 from Ilhasoft/hotfix/ivr-cron-retry-calls
Browse files Browse the repository at this point in the history
ignore throttled channel validation on retryCalls ivr cron
  • Loading branch information
rasoro authored Oct 8, 2021
2 parents 250d745 + 0789b0c commit 27d5b3b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/tasks/ivr/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ 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)
},
)

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)
},
Expand All @@ -52,10 +52,10 @@ 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)
conns, err := models.LoadChannelConnectionsToRetry(ctx, rt.DB, 200)
if err != nil {
return errors.Wrapf(err, "error loading connections to retry")
}
Expand All @@ -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())
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 27d5b3b

Please sign in to comment.