mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-23 04:36:50 +00:00
More loading screen improvements
This commit is contained in:
@@ -643,7 +643,7 @@ public class ArbitraryResource {
|
||||
ArbitraryDataReader reader = new ArbitraryDataReader(name, ArbitraryDataFile.ResourceIdType.NAME, service, null);
|
||||
try {
|
||||
reader.loadSynchronously(false);
|
||||
} catch (DataException | IOException | MissingDataException e) {
|
||||
} catch (Exception e) {
|
||||
// No need to handle exception, as it will be reflected in the status
|
||||
}
|
||||
}
|
||||
|
@@ -68,7 +68,7 @@ public class ArbitraryDataResource {
|
||||
|
||||
// Check if we have all data locally for this resource
|
||||
if (!this.allFilesDownloaded()) {
|
||||
if (this.madeRecentRequest()) {
|
||||
if (this.isDataPotentiallyAvailable()) {
|
||||
return new ArbitraryResourceSummary(ArbitraryResourceStatus.DOWNLOADING);
|
||||
}
|
||||
return new ArbitraryResourceSummary(ArbitraryResourceStatus.MISSING_DATA);
|
||||
@@ -115,7 +115,12 @@ public class ArbitraryDataResource {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean madeRecentRequest() {
|
||||
/**
|
||||
* Best guess as to whether data might be available
|
||||
* This is only used to give an indication to the user of progress
|
||||
* @return - whether data might be available on the network
|
||||
*/
|
||||
private boolean isDataPotentiallyAvailable() {
|
||||
try {
|
||||
this.fetchTransactions();
|
||||
Long now = NTP.getTime();
|
||||
@@ -127,7 +132,9 @@ public class ArbitraryDataResource {
|
||||
|
||||
for (ArbitraryTransactionData transactionData : transactionDataList) {
|
||||
long lastRequestTime = ArbitraryDataManager.getInstance().lastRequestForSignature(transactionData.getSignature());
|
||||
if (now - lastRequestTime < 30 * 1000L) {
|
||||
// If we haven't requested yet, or requested in the last 30 seconds, there's still a
|
||||
// chance that data is on its way but hasn't arrived yet
|
||||
if (lastRequestTime == 0 || now - lastRequestTime < 30 * 1000L) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -666,6 +666,7 @@ public class ArbitraryDataManager extends Thread {
|
||||
String peerAddress = peer.getPeerData().getAddress().toString();
|
||||
LOGGER.info("Adding arbitrary peer: {} for signature {}", peerAddress, Base58.encode(signature));
|
||||
ArbitraryPeerData arbitraryPeerData = new ArbitraryPeerData(signature, peer);
|
||||
repository.discardChanges();
|
||||
repository.getArbitraryRepository().save(arbitraryPeerData);
|
||||
repository.saveChanges();
|
||||
}
|
||||
|
Reference in New Issue
Block a user