[bisq-network/bisq] Prevent UI freeze in BSQ dashboard view. (PR #6131)

chimp1984 notifications at github.com
Tue Apr 5 23:44:25 CEST 2022


@chimp1984 commented on this pull request.

utACK

> @@ -301,28 +296,16 @@ public Date getLastRequestTimeStamp() {
         return new Date(epochInMillisAtLastRequest);
     }
 
-    public void applyLatestBisqMarketPrice(Set<TradeStatistics3> tradeStatisticsSet) {
-        // takes about 10 ms for 5000 items
-        Map<String, List<TradeStatistics3>> mapByCurrencyCode = new HashMap<>();
-        tradeStatisticsSet.forEach(e -> {
-            List<TradeStatistics3> list;
-            String currencyCode = e.getCurrency();
-            if (mapByCurrencyCode.containsKey(currencyCode)) {
-                list = mapByCurrencyCode.get(currencyCode);
-            } else {
-                list = new ArrayList<>();
-                mapByCurrencyCode.put(currencyCode, list);
+    public void applyInitialBisqMarketPrice(Map<String, Price> priceByCurrencyCode) {
+        priceByCurrencyCode.forEach((currencyCode, price) -> {
+            if (!cache.containsKey(currencyCode) || !cache.get(currencyCode).isExternallyProvidedPrice()) {
+                cache.put(currencyCode, new MarketPrice(currencyCode,

Those lines are duplicate to the code in setBisqMarketPrice, maybe extract it as a method.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/6131#pullrequestreview-932550636
You are receiving this because you are subscribed to this thread.

Message ID: <bisq-network/bisq/pull/6131/review/932550636 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20220405/122f6f0a/attachment.htm>


More information about the bisq-github mailing list