Skip to content

Commit 4761850

Browse files
committed
Rename variables for clarity
1 parent fc047a6 commit 4761850

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

core/msgio/courier.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func QueueCourierMessages(rc redis.Conn, contactID models.ContactID, msgs []*mod
117117
return commitBatch()
118118
}
119119

120-
var clearChannelQueueScript = redis.NewScript(3, `
120+
var queueClearScript = redis.NewScript(3, `
121121
-- KEYS: [QueueType, QueueName, TPS]
122122
local queueType, queueName, tps = KEYS[1], KEYS[2], tonumber(KEYS[3])
123123
@@ -130,10 +130,10 @@ redis.call("DEL", queueKey .. "/0")
130130
131131
-- reset queue to zero
132132
redis.call("ZADD", queueType .. ":active", 0, queueKey)
133-
134133
`)
135134

136-
func ClearChannelCourierQueue(rc redis.Conn, ch *models.Channel) error {
137-
_, err := clearChannelQueueScript.Do(rc, "msgs", ch.UUID(), ch.TPS())
135+
// ClearCourierQueues clears the courier queues (priority and bulk) for the given channel
136+
func ClearCourierQueues(rc redis.Conn, ch *models.Channel) error {
137+
_, err := queueClearScript.Do(rc, "msgs", ch.UUID(), ch.TPS())
138138
return err
139139
}

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)