Skip to content

Commit

Permalink
Merge pull request #7355 from alvasw/RestApi_Fix_parseBlockCompleteAf…
Browse files Browse the repository at this point in the history
…terBatchProcessing_data_race

RestApi: Fix parseBlockCompleteAfterBatchProcessing data race
  • Loading branch information
alejandrogarcia83 authored Jan 15, 2025
2 parents 3d86bbf + 9463bf5 commit 0b56ce5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions restapi/src/main/java/bisq/restapi/RestApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import bisq.common.app.Version;
import bisq.common.config.Config;

import java.util.concurrent.atomic.AtomicBoolean;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -69,7 +71,7 @@ public class RestApi extends ExecutableForAppWithP2p {
private OfferBookService offerBookService;
private PriceFeedService priceFeedService;
@Getter
private boolean parseBlockCompleteAfterBatchProcessing;
private final AtomicBoolean parseBlockCompleteAfterBatchProcessing = new AtomicBoolean();

public RestApi() {
super("Bisq Rest Api", "bisq_restapi", "bisq_restapi", Version.VERSION);
Expand Down Expand Up @@ -108,7 +110,7 @@ protected void applyInjector() {
@Override
public void onParseBlockCompleteAfterBatchProcessing(Block block) {
log.error("onParseBlockCompleteAfterBatchProcessing");
parseBlockCompleteAfterBatchProcessing = true;
parseBlockCompleteAfterBatchProcessing.set(true);
}
});
}
Expand All @@ -130,6 +132,6 @@ protected void onHiddenServicePublished() {
}

public void checkDaoReady() {
checkArgument(parseBlockCompleteAfterBatchProcessing, "DAO not ready yet");
checkArgument(parseBlockCompleteAfterBatchProcessing.get(), "DAO not ready yet");
}
}

0 comments on commit 0b56ce5

Please sign in to comment.