Commit 8a3a32d8 authored by Bergamote Orange's avatar Bergamote Orange
Browse files

Merge branch 'heads/bugfix-rate-limiting'

parents 492b6821 28b91c26
Pipeline #576010 passed with stages
in 20 minutes and 31 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()
);
}
}
server:
port: ${ROBERT_PUSH_SERVER_PORT:9096}
port: :9096
spring:
datasource:
url: ${ROBERT_PUSH_SERVER_DB_URL:jdbc:postgresql://localhost:5432/push}
username: ${ROBERT_PUSH_SERVER_DB_USR:robert-push}
password: ${ROBERT_PUSH_SERVER_DB_PWD:robert}
url: jdbc:postgresql://localhost:5432/push
username: robert-push
password: robert
# Min/Max Push Notification Hours
robert.push.server:
......
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