mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge branch 'master' into release-candidate-0.9.0
# Conflicts: # core/src/main/java/bisq/core/payment/AccountAgeWitnessService.java
This commit is contained in:
commit
12e875240d
@ -39,7 +39,7 @@ configure(subprojects) {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://raw.githubusercontent.com/JesusMcCloud/tor-binary/master/release/' }
|
||||
maven { url 'https://raw.githubusercontent.com/JesusMcCloud/tor-binary/7.5/release/' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -125,7 +125,7 @@ configure(project(':common')) {
|
||||
configure(project(':p2p')) {
|
||||
dependencies {
|
||||
compile project(':common')
|
||||
compile('com.github.JesusMcCloud.netlayer:tor.native:0.4.7') {
|
||||
compile('com.github.JesusMcCloud.netlayer:tor.native:0.4.7.1') {
|
||||
exclude(module: 'slf4j-api')
|
||||
}
|
||||
compile('org.apache.httpcomponents:httpclient:4.5.3') {
|
||||
|
@ -136,9 +136,7 @@ public class AccountAgeWitnessService {
|
||||
}
|
||||
|
||||
private void addToMap(AccountAgeWitness accountAgeWitness) {
|
||||
//log.debug("addToMap hash=" + Utilities.bytesAsHexString(accountAgeWitness.getHash()));
|
||||
if (!accountAgeWitnessMap.containsKey(accountAgeWitness.getHashAsByteArray()))
|
||||
accountAgeWitnessMap.put(accountAgeWitness.getHashAsByteArray(), accountAgeWitness);
|
||||
accountAgeWitnessMap.putIfAbsent(accountAgeWitness.getHashAsByteArray(), accountAgeWitness);
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ dependencyVerification {
|
||||
'de.jensd:fontawesomefx-commons:5539bb3335ecb822dbf928546f57766eeb9f1516cc1417a064b5709629612149',
|
||||
'com.googlecode.jcsv:jcsv:73ca7d715e90c8d2c2635cc284543b038245a34f70790660ed590e157b8714a2',
|
||||
'com.github.sarxos:webcam-capture:d960b7ea8ec3ddf2df0725ef214c3fccc9699ea7772df37f544e1f8e4fd665f6',
|
||||
'com.github.JesusMcCloud.netlayer:tor.native:c4c1ca96e6fbef3325db5d1cf9d6593ede4e6799b9242959fcce6f322cf5713c',
|
||||
'com.github.JesusMcCloud.netlayer:tor.native:062eb5ae2750259da8aabf4de6ee77af49423d615ad6f0645ccccadff2171e86',
|
||||
'org.apache.httpcomponents:httpclient:db3d1b6c2d6a5e5ad47577ad61854e2f0e0936199b8e05eb541ed52349263135',
|
||||
'net.sf.jopt-simple:jopt-simple:6f45c00908265947c39221035250024f2caec9a15c1c8cf553ebeecee289f342',
|
||||
'org.fxmisc.easybind:easybind:666af296dda6de68751668a62661571b5238ac6f1c07c8a204fc6f902b222aaf',
|
||||
@ -37,7 +37,7 @@ dependencyVerification {
|
||||
'com.google.code.findbugs:jsr305:c885ce34249682bc0236b4a7d56efcc12048e6135a5baf7a9cde8ad8cda13fcd',
|
||||
'com.google.guava:guava:36a666e3b71ae7f0f0dca23654b67e086e6c93d192f60ba5dfd5519db6c288c8',
|
||||
'com.google.inject:guice:9b9df27a5b8c7864112b4137fd92b36c3f1395bfe57be42fedf2f520ead1a93e',
|
||||
'com.github.JesusMcCloud.netlayer:tor:6341e4097534d500218320ba5e9dc1e926df0d913b7c949adc842db815cc8e1f',
|
||||
'com.github.JesusMcCloud.netlayer:tor:0068ddaa9b9bd7e47a677985ea6a01baf1c75c265d988a42bfcde5f204f554a0',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk8:b306e0e6735841e31e320bf3260c71d60fc35057cfa87895f23251ee260a64a8',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk7:169ee5879cba8444499243ceea5e6a2cb6ecea5424211cc819f0704501154b35',
|
||||
'io.github.microutils:kotlin-logging:4992504fd3c6ecdf9ed10874b9508e758bb908af9e9d7af19a61e9afb6b7e27a',
|
||||
|
@ -44,13 +44,13 @@ import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.SettableFuture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -273,34 +273,25 @@ class RequestDataHandler implements MessageListener {
|
||||
});
|
||||
}
|
||||
|
||||
// We process the LazyProcessedStoragePayload items (TradeStatistics) in batches with a delay in between.
|
||||
// We want avoid that the UI get stuck when processing many entries.
|
||||
// The dataStorage.add call is a bit expensive as sig checks is done there.
|
||||
|
||||
// Using a background thread might be an alternative but it would require much more effort and
|
||||
// it would also decrease user experience if the app gets under heavy load (like at startup with wallet sync).
|
||||
// Beside that we mitigated the problem already as we will not get the whole TradeStatistics as we
|
||||
// pass the excludeKeys and we pack the latest data dump
|
||||
// into the resources, so a new user do not need to request all data.
|
||||
|
||||
// In future we will probably limit by date or load on demand from user intent to not get too much data.
|
||||
|
||||
// We split the list into sub lists with max 50 items and delay each batch with 200 ms.
|
||||
int size = processDelayedItems.size();
|
||||
int chunkSize = 50;
|
||||
int chunks = 1 + size / chunkSize;
|
||||
int startIndex = 0;
|
||||
for (int i = 0; i < chunks && startIndex < size; i++, startIndex += chunkSize) {
|
||||
long delay = (i + 1) * 200;
|
||||
int endIndex = Math.min(size, startIndex + chunkSize);
|
||||
List<NetworkPayload> subList = processDelayedItems.subList(startIndex, endIndex);
|
||||
UserThread.runAfter(() -> subList.stream().forEach(item -> {
|
||||
if (item instanceof ProtectedStorageEntry)
|
||||
dataStorage.addProtectedStorageEntry((ProtectedStorageEntry) item, sender, null, false, false);
|
||||
else if (item instanceof PersistableNetworkPayload)
|
||||
dataStorage.addPersistableNetworkPayload((PersistableNetworkPayload) item, sender, false, false, false, false);
|
||||
}), delay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
// We changed the earlier behaviour with delayed execution of chunks of the list as it caused
|
||||
// worse results as if it is processed in one go.
|
||||
// Main reason is probably that listeners trigger more code and if that is called early at
|
||||
// startup we have better chances that the user has not already navigated to a screen where the
|
||||
// trade statistics are used for UI rendering.
|
||||
// We need to take care that the update period between releases stay short as with the current
|
||||
// situation before 0.9 release we receive 4000 objects with a newly installed client, which
|
||||
// causes the application to stay stuck for quite a while at startup.
|
||||
log.info("Start processing {} delayedItems.", processDelayedItems.size());
|
||||
long startTs = new Date().getTime();
|
||||
processDelayedItems.forEach(item -> {
|
||||
if (item instanceof ProtectedStorageEntry)
|
||||
dataStorage.addProtectedStorageEntry((ProtectedStorageEntry) item, sender, null,
|
||||
false, false);
|
||||
else if (item instanceof PersistableNetworkPayload)
|
||||
dataStorage.addPersistableNetworkPayload((PersistableNetworkPayload) item, sender,
|
||||
false, false, false, false);
|
||||
});
|
||||
log.info("Processing delayedItems completed after {} sec.", (new Date().getTime() - startTs) / 1000D);
|
||||
|
||||
cleanup();
|
||||
listener.onComplete();
|
||||
|
Loading…
Reference in New Issue
Block a user