Skip to content
This repository has been archived by the owner on Mar 27, 2022. It is now read-only.

Commit

Permalink
fix: ECONNREFUSED retry once
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jan 11, 2022
1 parent 3b7052f commit 1a8f4ab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sync/syncer.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ proto.syncFile = function* (info, retry) {

logger.syncInfo('[%s] upload %s to nfs:%s with size:%s, sha1:%s, md5: %s',
this.category, args.key, info.url, bytes(info.size), info.sha1, info.md5);
} catch (err) {
// Error: connect ECONNREFUSED 116.0.89.227:443
if (err.message.includes('ECONNREFUSED')) {
logger.syncInfo('[%s] ECONNREFUSED error, retry after 10s, %s',
this.category, err);
yield sleep(10000);
return yield this.syncFile(info, true);
}
throw err;
} finally {
// remove tmp file whatever
fs.unlink(filepath, utility.noop);
Expand Down

0 comments on commit 1a8f4ab

Please sign in to comment.