Retry Events
Track automatic retries with onTaskRetry and onRetry (chunk-level).
(function() {
var logEl = document.getElementById('log');
function log(m) { var d = document.createElement('div'); d.className='pkg-log-entry'; d.textContent=m; logEl.appendChild(d); logEl.scrollTop=logEl.scrollHeight; }
new MultipleUpload('#demo', {
uploadUrl: '/api/upload',
multiple: true,
retries: 3,
retryDelay: 1000,
retryBackoff: 'exponential',
chunked: true,
chunkSize: '1MB',
onTaskRetry: function(task) {
log('[taskRetry] ' + task.fileName + ' attempt #' + task.retryCount);
},
onRetry: function(file, chunkIdx, attempt) {
log('[chunkRetry] ' + file.name + ' chunk ' + chunkIdx + ' attempt ' + attempt);
}
});
})();Watching the retries happen
onRetry fires each time a failed upload is attempted again. Retries are automatic — retries defaults to 2 — so without this callback a transient failure and a clean first-time success look identical from outside.
Worth logging even when it works
A file that succeeds on the third attempt is a success the user never noticed and a signal you probably want: it usually means a flaky network, a server under load, or a chunk size that is too large for the connections your users actually have. The information is only there if something is listening.