Commit 629f0217 authored by Bergamote Orange's avatar Bergamote Orange
Browse files

bugfix: switch global rate limiting to per-client rate limiting

parent 91e96543
Pipeline #576011 canceled with stages
in 12 minutes and 9 seconds
......@@ -65,18 +65,23 @@ public class ApnsClientConfiguration {
}
}
private ApnsOperations buildRateLimitingTemplate(final ApnsOperations apnsOperations) {
return new RateLimitingApnsTemplate(
robertPushServerProperties.getMaxNotificationsPerSecond(),
robertPushServerProperties.getMaxNumberOfPendingNotifications(),
apnsOperations
);
}
@Bean
public ApnsOperations apnsTemplate() {
final var mesuredApnsTemplates = robertPushServerProperties.getApns().getClients().stream()
final var measuredRateLimitedApnsTemplates = robertPushServerProperties.getApns().getClients().stream()
.map(this::buildMeasureApnsTemplate)
.map(this::buildRateLimitingTemplate)
.collect(toUnmodifiableList());
return new RateLimitingApnsTemplate(
robertPushServerProperties.getMaxNotificationsPerSecond(),
robertPushServerProperties.getMaxNumberOfPendingNotifications(),
new FailoverApnsTemplate(
mesuredApnsTemplates, robertPushServerProperties.getApns().getInactiveRejectionReason()
)
return new FailoverApnsTemplate(
measuredRateLimitedApnsTemplates, robertPushServerProperties.getApns().getInactiveRejectionReason()
);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment