Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public void onOpen(WebSocket webSocket, Response response) {

// Fetch missed events if we have a last event time
if (lastEventTime > 0) {
fetchEventLog(tenantId, urlId, userIdWS, lastEventTime, new Date().getTime(),
fetchEventLog(config.region, tenantId, urlId, userIdWS, lastEventTime, new Date().getTime(),
events -> processEvents(events, canSeeCommentsCallback, handleLiveEvent));
}

Expand Down Expand Up @@ -253,7 +253,7 @@ public void onFailure(WebSocket webSocket, Throwable t, Response response) {

// Fetch missed events if we have a last event time
if (lastEventTime > 0) {
fetchEventLog(tenantId, urlId, userIdWS, lastEventTime, new Date().getTime(),
fetchEventLog(config.region, tenantId, urlId, userIdWS, lastEventTime, new Date().getTime(),
events -> processEvents(events, canSeeCommentsCallback, handleLiveEvent));
}
}
Expand Down Expand Up @@ -323,6 +323,7 @@ public void run() {
* Fetch event log from API using PublicApi client
*/
private static void fetchEventLog(
String region,
String tenantId,
String urlId,
String userIdWS,
Expand All @@ -331,8 +332,13 @@ private static void fetchEventLog(
Consumer<List<LiveEvent>> callback
) {
try {
// Create PublicApi instance with its own HTTP client
PublicApi publicApi = new PublicApi(new ApiClient(httpClient));
// Create PublicApi instance with its own HTTP client, pointed at the region's host
// so the "fetch missed events" fallback queries EU infra for EU tenants instead of US.
ApiClient apiClient = new ApiClient(httpClient);
if (Objects.equals(region, "eu")) {
apiClient.setBasePath("https://eu.fastcomments.com");
}
PublicApi publicApi = new PublicApi(apiClient);

// Create API request
PublicApi.APIgetEventLogRequest request =
Expand Down
Loading