[bisq-network/bisq] Reduce initial request size (#4233)

Florian Reimair notifications at github.com
Wed May 20 07:59:51 UTC 2020


@freimair commented on this pull request.



> +        if (getMap().containsKey(hash))
+            return;
+
+        store.getMap().put(hash, payload);
+        persist();
+    }
+
+    @Override
+    protected PersistableNetworkPayload putIfAbsent(P2PDataStorage.ByteArray hash,
+                                                    PersistableNetworkPayload payload) {
+        // make sure we do not add data that we already have (in a bin of historical data)
+        if (getMap().containsKey(hash))
+            return null;
+
+        PersistableNetworkPayload previous = store.getMap().putIfAbsent(hash, payload);
+        persist();

agreed. However, it is not trivial to find whether there has been something added to the map or not since the nested `put(...)` only returns the old value.

I believe that is why MapStoreService does this exactly that way (and that might be one source of our IO issues.

I decided to stick with the "proven" way of doing things until we can address the whole disk IO issue in a more general way https://github.com/bisq-network/projects/issues/29



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4233#discussion_r427813743
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200520/3445d505/attachment.html>


More information about the bisq-github mailing list