forked from Qortal/qortal
More loading screen improvements
This commit is contained in:
parent
9ef75ebcde
commit
f6b9ff50c3
@ -643,7 +643,7 @@ public class ArbitraryResource {
|
|||||||
ArbitraryDataReader reader = new ArbitraryDataReader(name, ArbitraryDataFile.ResourceIdType.NAME, service, null);
|
ArbitraryDataReader reader = new ArbitraryDataReader(name, ArbitraryDataFile.ResourceIdType.NAME, service, null);
|
||||||
try {
|
try {
|
||||||
reader.loadSynchronously(false);
|
reader.loadSynchronously(false);
|
||||||
} catch (DataException | IOException | MissingDataException e) {
|
} catch (Exception e) {
|
||||||
// No need to handle exception, as it will be reflected in the status
|
// 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
|
// Check if we have all data locally for this resource
|
||||||
if (!this.allFilesDownloaded()) {
|
if (!this.allFilesDownloaded()) {
|
||||||
if (this.madeRecentRequest()) {
|
if (this.isDataPotentiallyAvailable()) {
|
||||||
return new ArbitraryResourceSummary(ArbitraryResourceStatus.DOWNLOADING);
|
return new ArbitraryResourceSummary(ArbitraryResourceStatus.DOWNLOADING);
|
||||||
}
|
}
|
||||||
return new ArbitraryResourceSummary(ArbitraryResourceStatus.MISSING_DATA);
|
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 {
|
try {
|
||||||
this.fetchTransactions();
|
this.fetchTransactions();
|
||||||
Long now = NTP.getTime();
|
Long now = NTP.getTime();
|
||||||
@ -127,7 +132,9 @@ public class ArbitraryDataResource {
|
|||||||
|
|
||||||
for (ArbitraryTransactionData transactionData : transactionDataList) {
|
for (ArbitraryTransactionData transactionData : transactionDataList) {
|
||||||
long lastRequestTime = ArbitraryDataManager.getInstance().lastRequestForSignature(transactionData.getSignature());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,6 +666,7 @@ public class ArbitraryDataManager extends Thread {
|
|||||||
String peerAddress = peer.getPeerData().getAddress().toString();
|
String peerAddress = peer.getPeerData().getAddress().toString();
|
||||||
LOGGER.info("Adding arbitrary peer: {} for signature {}", peerAddress, Base58.encode(signature));
|
LOGGER.info("Adding arbitrary peer: {} for signature {}", peerAddress, Base58.encode(signature));
|
||||||
ArbitraryPeerData arbitraryPeerData = new ArbitraryPeerData(signature, peer);
|
ArbitraryPeerData arbitraryPeerData = new ArbitraryPeerData(signature, peer);
|
||||||
|
repository.discardChanges();
|
||||||
repository.getArbitraryRepository().save(arbitraryPeerData);
|
repository.getArbitraryRepository().save(arbitraryPeerData);
|
||||||
repository.saveChanges();
|
repository.saveChanges();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
<title>Loading...</title>
|
<title>Loading...</title>
|
||||||
<style>
|
<style>
|
||||||
canvas {
|
canvas {
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@ -80,13 +79,14 @@
|
|||||||
textStatus = "Build failed. Please try again later.";
|
textStatus = "Build failed. Please try again later.";
|
||||||
}
|
}
|
||||||
else if (json.status == "DOWNLOADING") {
|
else if (json.status == "DOWNLOADING") {
|
||||||
textStatus = "Locating files in data network...";
|
textStatus = "Locating and downloading files...";
|
||||||
retryInterval = 5000;
|
retryInterval = 1000;
|
||||||
}
|
}
|
||||||
else if (json.status == "MISSING_DATA") {
|
else if (json.status == "MISSING_DATA") {
|
||||||
textStatus = "Unable to locate files. Please try again later.";
|
textStatus = "Unable to locate all files. Please try again later.";
|
||||||
retryInterval = 10000;
|
retryInterval = 10000;
|
||||||
document.getElementById("status").style.color = "red";
|
document.getElementById("status").style.color = "red";
|
||||||
|
document.getElementById("c").style.opacity = "0.5";
|
||||||
}
|
}
|
||||||
else if (json.status == "DOWNLOADED") {
|
else if (json.status == "DOWNLOADED") {
|
||||||
textStatus = "Files downloaded";
|
textStatus = "Files downloaded";
|
||||||
@ -115,7 +115,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- partial:index.partial.html -->
|
<!-- partial:index.partial.html -->
|
||||||
<canvas id=c></canvas>
|
<canvas id="c"></canvas>
|
||||||
<!-- partial -->
|
<!-- partial -->
|
||||||
<script>
|
<script>
|
||||||
var w = c.width = window.innerWidth,
|
var w = c.width = window.innerWidth,
|
||||||
@ -125,8 +125,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
opts = {
|
opts = {
|
||||||
|
|
||||||
len: 40, // Size
|
len: 40, // Size
|
||||||
count: 50,
|
count: 250,
|
||||||
baseTime: 10,
|
baseTime: 40,
|
||||||
addedTime: 10,
|
addedTime: 10,
|
||||||
dieChance: .05, // Lifetime
|
dieChance: .05, // Lifetime
|
||||||
spawnChance: 1,
|
spawnChance: 1,
|
||||||
@ -137,7 +137,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
color: 'hsl(hue,100%,light%)',
|
color: 'hsl(hue,100%,light%)',
|
||||||
baseLight: 50,
|
baseLight: 50,
|
||||||
addedLight: 10, // [50-10,50+10]
|
addedLight: 10, // [50-10,50+10]
|
||||||
shadowToTimePropMult: 6,
|
shadowToTimePropMult: 1,
|
||||||
baseLightInputMultiplier: .01,
|
baseLightInputMultiplier: .01,
|
||||||
addedLightInputMultiplier: .02,
|
addedLightInputMultiplier: .02,
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
|
|
||||||
baseRad = Math.PI * 2 / 6;
|
baseRad = Math.PI * 2 / 6;
|
||||||
|
|
||||||
ctx.fillStyle = 'black'; // Fade in
|
ctx.fillStyle = 'white';
|
||||||
ctx.fillRect( 0, 0, w, h );
|
ctx.fillRect( 0, 0, w, h );
|
||||||
|
|
||||||
function loop() {
|
function loop() {
|
||||||
@ -166,7 +166,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
|
|
||||||
ctx.globalCompositeOperation = 'source-over';
|
ctx.globalCompositeOperation = 'source-over';
|
||||||
ctx.shadowBlur = 0;
|
ctx.shadowBlur = 0;
|
||||||
ctx.fillStyle = 'rgba(255,255,255,alp)'.replace( 'alp', opts.repaintAlpha );
|
ctx.fillStyle = 'rgba(230,230,230,alp)'.replace( 'alp', opts.repaintAlpha );
|
||||||
ctx.fillRect( 0, 0, w, h );
|
ctx.fillRect( 0, 0, w, h );
|
||||||
ctx.globalCompositeOperation = 'darker';
|
ctx.globalCompositeOperation = 'darker';
|
||||||
|
|
||||||
@ -250,8 +250,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
|
|
||||||
<div id="panel-outer">
|
<div id="panel-outer">
|
||||||
<div id="panel">
|
<div id="panel">
|
||||||
<h1>Loading</h1>
|
<h2>Loading</h2>
|
||||||
<p>This page will refresh automatically when the content becomes available</p>
|
<p>
|
||||||
|
Files are being retrieved from the Qortal Data Network.
|
||||||
|
This page will refresh automatically when the content becomes available.
|
||||||
|
</p>
|
||||||
<p><span id="status">Loading...</span></p>
|
<p><span id="status">Loading...</span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user