mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +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) {
|
public void setState(Offer.State state) {
|
||||||
UserThread.await(() -> stateProperty().set(state));
|
stateProperty.set(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectProperty<Offer.State> stateProperty() {
|
public ObjectProperty<Offer.State> stateProperty() {
|
||||||
|
|
|
@ -200,6 +200,7 @@ public class MarketView extends ActivatableView<TabPane, Void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAllOffersWithReferralId() {
|
private String getAllOffersWithReferralId() {
|
||||||
|
synchronized (offerBook.getOfferBookListItems()) {
|
||||||
List<String> list = offerBook.getOfferBookListItems().stream()
|
List<String> list = offerBook.getOfferBookListItems().stream()
|
||||||
.map(OfferBookListItem::getOffer)
|
.map(OfferBookListItem::getOffer)
|
||||||
.filter(offer -> offer.getExtraDataMap() != null)
|
.filter(offer -> offer.getExtraDataMap() != null)
|
||||||
|
@ -219,3 +220,4 @@ public class MarketView extends ActivatableView<TabPane, Void> {
|
||||||
return Joiner.on("\n\n").join(list);
|
return Joiner.on("\n\n").join(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@ class OfferBookChartViewModel extends ActivatableViewModel {
|
||||||
|
|
||||||
private void fillTradeCurrencies() {
|
private void fillTradeCurrencies() {
|
||||||
// Don't use a set as we need all entries
|
// Don't use a set as we need all entries
|
||||||
|
synchronized (offerBookListItems) {
|
||||||
List<TradeCurrency> tradeCurrencyList = offerBookListItems.stream()
|
List<TradeCurrency> tradeCurrencyList = offerBookListItems.stream()
|
||||||
.map(e -> {
|
.map(e -> {
|
||||||
String currencyCode = e.getOffer().getCurrencyCode();
|
String currencyCode = e.getOffer().getCurrencyCode();
|
||||||
|
@ -158,6 +159,7 @@ class OfferBookChartViewModel extends ActivatableViewModel {
|
||||||
|
|
||||||
currencyListItems.updateWithCurrencies(tradeCurrencyList, null);
|
currencyListItems.updateWithCurrencies(tradeCurrencyList, null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void activate() {
|
protected void activate() {
|
||||||
|
|
|
@ -350,6 +350,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void applyOfferState(Offer.State state) {
|
private void applyOfferState(Offer.State state) {
|
||||||
|
UserThread.execute(() -> {
|
||||||
offerWarning.set(null);
|
offerWarning.set(null);
|
||||||
|
|
||||||
// We have 2 situations handled here:
|
// We have 2 situations handled here:
|
||||||
|
@ -394,6 +395,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||||
updateSpinnerInfo();
|
updateSpinnerInfo();
|
||||||
|
|
||||||
updateButtonDisableState();
|
updateButtonDisableState();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyTradeErrorMessage(@Nullable String errorMessage) {
|
private void applyTradeErrorMessage(@Nullable String errorMessage) {
|
||||||
|
|
Loading…
Reference in a new issue