1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

log while retrying

This commit is contained in:
Bruno Windels
2020-04-23 15:25:10 +02:00
parent 30101a4428
commit 86913dccb0

View File

@@ -757,6 +757,7 @@ export async function retryNetworkOperation(maxAttempts, callback) {
try {
if (attempts > 0) {
const timeout = 1000 * Math.pow(2, attempts);
console.log(`network operation failed ${attempts} times, retrying in ${timeout}ms...`);
await new Promise(r => setTimeout(r, timeout));
}
return await callback();