Skip to content

Commit ffa82b2

Browse files
committed
Merge branch 'main' into fetch_attachments
2 parents 75b8954 + 4761850 commit ffa82b2

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v7.5.17
2+
----------
3+
* Update to latest goflow
4+
* Add interrupt channel task
5+
16
v7.5.16
27
----------
38
* If starting a message flow from an ivr trigger, send reject response

core/msgio/courier.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func QueueCourierMessages(rc redis.Conn, contactID models.ContactID, msgs []*mod
130130
return commitBatch()
131131
}
132132

133-
var clearChannelQueueScript = redis.NewScript(3, `
133+
var queueClearScript = redis.NewScript(3, `
134134
-- KEYS: [QueueType, QueueName, TPS]
135135
local queueType, queueName, tps = KEYS[1], KEYS[2], tonumber(KEYS[3])
136136
@@ -143,11 +143,11 @@ redis.call("DEL", queueKey .. "/0")
143143
144144
-- reset queue to zero
145145
redis.call("ZADD", queueType .. ":active", 0, queueKey)
146-
147146
`)
148147

149-
func ClearChannelCourierQueue(rc redis.Conn, ch *models.Channel) error {
150-
_, err := clearChannelQueueScript.Do(rc, "msgs", ch.UUID(), ch.TPS())
148+
// ClearCourierQueues clears the courier queues (priority and bulk) for the given channel
149+
func ClearCourierQueues(rc redis.Conn, ch *models.Channel) error {
150+
_, err := queueClearScript.Do(rc, "msgs", ch.UUID(), ch.TPS())
151151
return err
152152
}
153153

core/msgio/courier_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ func TestClearChannelCourierQueue(t *testing.T) {
8888
})
8989

9090
twilioChannel := oa.ChannelByID(testdata.TwilioChannel.ID)
91-
msgio.ClearChannelCourierQueue(rc, twilioChannel)
91+
msgio.ClearCourierQueues(rc, twilioChannel)
9292

9393
testsuite.AssertCourierQueues(t, map[string][]int{
9494
"msgs:19012bfd-3ce3-4cae-9bb9-76cf92c73d49|10/0": {1}, // vonage, bulk priority
9595
})
9696

9797
vonageChannel := oa.ChannelByID(testdata.VonageChannel.ID)
98-
msgio.ClearChannelCourierQueue(rc, vonageChannel)
98+
msgio.ClearCourierQueues(rc, vonageChannel)
9999
testsuite.AssertCourierQueues(t, map[string][]int{})
100100

101101
}

core/tasks/channels/interrupt_channel.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (t *InterruptChannelTask) Perform(ctx context.Context, rt *runtime.Runtime,
4242
return errors.Wrapf(err, "error interrupting sessions")
4343
}
4444

45-
err = msgio.ClearChannelCourierQueue(rc, channel)
45+
err = msgio.ClearCourierQueues(rc, channel)
4646
if err != nil {
4747
return errors.Wrapf(err, "error clearing courier queues")
4848
}

0 commit comments

Comments
 (0)