mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +00:00
update offer state on same thread to fix blocking
This commit is contained in:
parent
6fea58c197
commit
59fbd805a5
4 changed files with 76 additions and 70 deletions
|
@ -265,7 +265,7 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void setState(Offer.State state) {
|
||||
UserThread.await(() -> stateProperty().set(state));
|
||||
stateProperty.set(state);
|
||||
}
|
||||
|
||||
public ObjectProperty<Offer.State> stateProperty() {
|
||||
|
|
|
@ -200,6 +200,7 @@ public class MarketView extends ActivatableView<TabPane, Void> {
|
|||
}
|
||||
|
||||
private String getAllOffersWithReferralId() {
|
||||
synchronized (offerBook.getOfferBookListItems()) {
|
||||
List<String> list = offerBook.getOfferBookListItems().stream()
|
||||
.map(OfferBookListItem::getOffer)
|
||||
.filter(offer -> offer.getExtraDataMap() != null)
|
||||
|
@ -219,3 +220,4 @@ public class MarketView extends ActivatableView<TabPane, Void> {
|
|||
return Joiner.on("\n\n").join(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@ class OfferBookChartViewModel extends ActivatableViewModel {
|
|||
|
||||
private void fillTradeCurrencies() {
|
||||
// Don't use a set as we need all entries
|
||||
synchronized (offerBookListItems) {
|
||||
List<TradeCurrency> tradeCurrencyList = offerBookListItems.stream()
|
||||
.map(e -> {
|
||||
String currencyCode = e.getOffer().getCurrencyCode();
|
||||
|
@ -158,6 +159,7 @@ class OfferBookChartViewModel extends ActivatableViewModel {
|
|||
|
||||
currencyListItems.updateWithCurrencies(tradeCurrencyList, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void activate() {
|
||||
|
|
|
@ -350,6 +350,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void applyOfferState(Offer.State state) {
|
||||
UserThread.execute(() -> {
|
||||
offerWarning.set(null);
|
||||
|
||||
// We have 2 situations handled here:
|
||||
|
@ -394,6 +395,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
updateSpinnerInfo();
|
||||
|
||||
updateButtonDisableState();
|
||||
});
|
||||
}
|
||||
|
||||
private void applyTradeErrorMessage(@Nullable String errorMessage) {
|
||||
|
|
Loading…
Reference in a new issue