Skip to content

Commit aa9ec10

Browse files
authored
Merge pull request #7809 from TheThingsNetwork/fix/downlink-queue-redis-exhaustion
Update DownlinkQueue operations RateLimit keys
2 parents 9afdbb7 + 1225141 commit aa9ec10

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ For details about compatibility between different releases, see the **Commitment
1313

1414
### Changed
1515

16+
- Rate limiting for downlink queue operations (`DownlinkQueuePush`, `DownlinkQueueReplace`) is now applied at the application level instead of per-device. This may result in more `ResourceExhausted` (429) errors when multiple devices under the same application perform downlink queue operations concurrently.
17+
1618
### Deprecated
1719

1820
### Removed

pkg/ttnpb/application_interfaces.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,13 @@ func (m *DownlinkQueueRequest) IDString() string {
210210
}
211211
return ids.IDString()
212212
}
213+
214+
// RateLimitKey implements ratelimit.Keyer.
215+
// Returns an application-level key to enable rate limiting per application for downlink queue operations.
216+
func (m *DownlinkQueueRequest) RateLimitKey() string {
217+
ids := m.EndDeviceIds
218+
if ids == nil {
219+
return ""
220+
}
221+
return "application:" + ids.GetApplicationIds().IDString()
222+
}

0 commit comments

Comments
 (0)