Skip to content

Commit

Permalink
Avoid sending duplicate-data when subscription is set up to use provi…
Browse files Browse the repository at this point in the history
…ded codespaces.
  • Loading branch information
lassetyr committed Oct 15, 2024
1 parent bd1ffe4 commit c25c4b9
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ private void processSiriClientRequest(String subscriptionId, InputStream xml)
subscriptionSetup.getDatasetId(),
sx.getSituations().getPtSituationElements()
));
serverSubscriptionManager.pushUpdatesAsync(subscriptionSetup.getSubscriptionType(), addedOrUpdated, subscriptionSetup.getDatasetId());
}
}
}
Expand All @@ -419,6 +418,10 @@ private void processSiriClientRequest(String subscriptionId, InputStream xml)
}
deliveryContainsData = addedOrUpdated.size() > 0;

if (!subscriptionSetup.isUseProvidedCodespaceId()) {
serverSubscriptionManager.pushUpdatesAsync(subscriptionSetup.getSubscriptionType(), addedOrUpdated, subscriptionSetup.getDatasetId());
}

subscriptionManager.incrementObjectCounter(subscriptionSetup, addedOrUpdated.size());

logger.info("Active SX-elements: {}, current delivery: {}, {}", situations.getSize(), addedOrUpdated.size(), subscriptionSetup);
Expand Down Expand Up @@ -476,7 +479,9 @@ private void processSiriClientRequest(String subscriptionId, InputStream xml)

deliveryContainsData = deliveryContainsData || (addedOrUpdated.size() > 0);

serverSubscriptionManager.pushUpdatesAsync(subscriptionSetup.getSubscriptionType(), addedOrUpdated, subscriptionSetup.getDatasetId());
if (!subscriptionSetup.isUseProvidedCodespaceId()) {
serverSubscriptionManager.pushUpdatesAsync(subscriptionSetup.getSubscriptionType(), addedOrUpdated, subscriptionSetup.getDatasetId());
}

subscriptionManager.incrementObjectCounter(subscriptionSetup, addedOrUpdated.size());

Expand Down Expand Up @@ -532,7 +537,9 @@ private void processSiriClientRequest(String subscriptionId, InputStream xml)

deliveryContainsData = deliveryContainsData || (addedOrUpdated.size() > 0);

serverSubscriptionManager.pushUpdatesAsync(subscriptionSetup.getSubscriptionType(), addedOrUpdated, subscriptionSetup.getDatasetId());
if (!subscriptionSetup.isUseProvidedCodespaceId()) {
serverSubscriptionManager.pushUpdatesAsync(subscriptionSetup.getSubscriptionType(), addedOrUpdated, subscriptionSetup.getDatasetId());
}

subscriptionManager.incrementObjectCounter(subscriptionSetup, addedOrUpdated.size());

Expand Down

0 comments on commit c25c4b9

Please sign in to comment.