1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

Archive links: drop initial delay to three-quarters of a second

Some, or perhaps even most, archives will not take all that long to archive.
The archive process starts as soon as the download button is initially
clicked, so in theory they could be done quite quickly.  Drop the initial
delay down to three-quarters of a second to make it more responsive in the
common case of the archive being quickly created.
This commit is contained in:
Kyle Evans 2020-05-05 16:11:37 -05:00
parent 64ac8440a7
commit 9397c13353

View File

@ -746,9 +746,11 @@ function getArchive($target, url, statusUrl) {
if (!xhr.responseJSON.complete && statusUrl !== null) { if (!xhr.responseJSON.complete && statusUrl !== null) {
$target.closest('.dropdown').children('i').addClass('loading'); $target.closest('.dropdown').children('i').addClass('loading');
// Wait for only three quarters of a second initially, in case it's
// quickly archived.
setTimeout(() => { setTimeout(() => {
initArchiveStatusChecker($target, url, statusUrl); initArchiveStatusChecker($target, url, statusUrl);
}, 2000); }, 750);
} else { } else {
// We don't need to continue checking. // We don't need to continue checking.
$target.closest('.dropdown').children('i').removeClass('loading'); $target.closest('.dropdown').children('i').removeClass('loading');