Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RestApi: Fix parseBlockCompleteAfterBatchProcessing data race #7355

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
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");
}
}
Loading