-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WA tiers paused #413
WA tiers paused #413
Conversation
Codecov Report
@@ Coverage Diff @@
## main #413 +/- ##
==========================================
- Coverage 71.95% 71.89% -0.07%
==========================================
Files 95 95
Lines 8348 8357 +9
==========================================
+ Hits 6007 6008 +1
- Misses 1747 1753 +6
- Partials 594 596 +2
Continue to review full report at Codecov.
|
queue/queue.go
Outdated
@@ -123,6 +123,14 @@ var luaPop = redis.NewScript(2, `-- KEYS: [EpochMS QueueType] | |||
|
|||
-- if we didn't find one, try again from our bulk queue | |||
if not result[1] or isFutureResult then | |||
-- check if we are paused for bulk queue | |||
local pausedBulkKey = "paused_bulk:" .. queueName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we call this rate_limit_bulk
so we have a way to rate limit everything and a way to rate limit just bulk sends
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so replace paused_bulk
with rate_limit_bulk
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah
handlers/whatsapp/whatsapp.go
Outdated
@@ -1022,6 +1034,15 @@ func buildWhatsAppHeaders(channel courier.Channel) http.Header { | |||
return header | |||
} | |||
|
|||
func hasTiersError(payload mtErrorPayload) bool { | |||
for _, err := range payload.Errors { | |||
if err.Code == 471 && err.Title == "Spam rate limit hit" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it important to check error title? Just wondering if that can change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove that
queue/queue_test.go
Outdated
@@ -60,6 +60,19 @@ func TestLua(t *testing.T) { | |||
delay := time.Second*2 - time.Duration(time.Now().UnixNano()%int64(time.Second)) | |||
time.Sleep(delay) | |||
|
|||
conn.Do("set", "paused_bulk:chan1", "engaged") | |||
conn.Do("EXPIRE", "paused_bulk:chan1", 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's start a convention of using UPPERCASE for redis commands
No description provided.