Skip to content

Commit

Permalink
#26633 Handle received exceptions when getting site response
Browse files Browse the repository at this point in the history
The commit modifies the logic to handle the processing of responses when invoking the verifyAndReturnSiteAfterCompletion method for site pushing. It now makes use of Java's CompletableFuture.exceptionally method, which allows us to handle exceptions that occur in the previous stages of the pipeline. This change also included a minor adjustment to clarify the calculation for ending time in the Runnable task.
  • Loading branch information
jgambarios committed Jan 31, 2024
1 parent 000acdd commit addfbeb
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,12 @@ private SiteView verifyAndReturnSiteAfterCompletion(final String operation,
final String siteName, final boolean isSiteLive,
final boolean isArchived) {

final var siteViewResponse = verifyAndReturnSiteAfterCompletion(
var siteViewFuture = verifyAndReturnSiteAfterCompletion(
siteName,
isSiteLive,
isArchived
).join();
);
final var siteViewResponse = siteViewFuture.exceptionally(ex -> null).join();

if (siteViewResponse == null) {
logger.error(
Expand Down Expand Up @@ -334,7 +335,7 @@ private CompletableFuture<SiteView> verifyAndReturnSiteAfterCompletion(
Runnable task = new Runnable() {

final long start = System.currentTimeMillis();
final long end = start + 15 * 1000;
final long end = start + (15 * 1000);

@Override
public void run() {
Expand Down

0 comments on commit addfbeb

Please sign in to comment.