Skip to content

Commit f94afaa

Browse files
EI Frontend clogged when old subscriptions are not removed. (#517)
1 parent 15c0ce6 commit f94afaa

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>com.github.ericsson</groupId>
88
<artifactId>eiffel-intelligence</artifactId>
9-
<version>3.2.3</version>
9+
<version>3.2.4</version>
1010
<packaging>war</packaging>
1111

1212
<parent>

src/main/java/com/ericsson/ei/notifications/HttpRequestSender.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
1919
import com.ericsson.ei.exception.AuthenticationException;
2020
import com.fasterxml.jackson.databind.JsonNode;
2121

22+
import java.time.Duration;
23+
2224
import org.slf4j.Logger;
2325
import org.slf4j.LoggerFactory;
26+
import org.springframework.beans.factory.annotation.Autowired;
27+
import org.springframework.beans.factory.annotation.Value;
2428
import org.springframework.boot.web.client.RestTemplateBuilder;
2529
import org.springframework.http.*;
2630
import org.springframework.stereotype.Component;
@@ -38,8 +42,10 @@ public class HttpRequestSender {
3842

3943
private RestOperations rest;
4044

41-
public HttpRequestSender(RestTemplateBuilder builder) {
42-
rest = builder.build();
45+
@Autowired
46+
public HttpRequestSender(RestTemplateBuilder builder, @Value("${notification.httpRequest.timeout:5000}") Duration timeOut) {
47+
timeOut = timeOut == null ? Duration.ofMillis(5000) : timeOut;
48+
rest = builder.setReadTimeout(timeOut).setConnectTimeout(timeOut).build();
4349
}
4450

4551
/**

src/main/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ waitlist.resend.fixed.rate: 15000
4646
failed.notifications.collection.name: failed_notifications
4747
failed.notifications.collection.ttl: 600
4848
notification.retry: 3
49+
notification.httpRequest.timeout: 5000
4950

5051
email.sender: noreply@domain.com
5152
email.subject: Email Subscription Notification

wiki/configuration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,13 @@ Eiffel Intelligence how long a failed notification will be stored in the
156156
database before deletion. With **notification.retry** property, it
157157
is possible to configure the number of attempts Eiffel Intelligence will
158158
retry to make a REST POST notification when a subscription is triggered.
159+
The **notification.httpRequest.timeout** property value will be used to set the
160+
response timeout for the Rest Post notifications when a subscription is triggered.
159161

160162
* failed.notifications.collection.name
161163
* failed.notifications.collection.ttl
162164
* notification.retry
165+
* notification.httpRequest.timeout
163166

164167
### Configure Search in Event Repository
165168

0 commit comments

Comments
 (0)