1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-12 22:57:38 +02:00

Fixed bad connection handling in synchronizer

This commit is contained in:
Laurent Cozic
2017-07-10 00:20:38 +01:00
parent dc4eb35fca
commit fdeb797750
6 changed files with 34 additions and 19 deletions

View File

@ -174,7 +174,7 @@ class OneDriveApi {
this.logger().info('Token expired: refreshing...');
await this.refreshAccessToken();
continue;
} else if (error && ((error.error && error.error.code == 'generalException') || (error.code == 'generalException'))) {
} else if (error && ((error.error && error.error.code == 'generalException') || error.code == 'generalException' || error.code == 'EAGAIN')) {
// Rare error (one Google hit) - I guess the request can be repeated
// { error:
// { code: 'generalException',
@ -182,11 +182,7 @@ class OneDriveApi {
// innerError:
// { 'request-id': 'b4310552-c18a-45b1-bde1-68e2c2345eef',
// date: '2017-06-29T00:15:50' } } }
this.logger().info('Got error below - retrying...');
this.logger().info(error);
await time.msleep(1000 * i);
continue;
} else if (error.code == 'EAGAIN') {
// { FetchError: request to https://graph.microsoft.com/v1.0/drive/root:/Apps/Joplin/.sync/7ee5dc04afcb414aa7c684bfc1edba8b.md_1499352102856 failed, reason: connect EAGAIN 65.52.64.250:443 - Local (0.0.0.0:54374)
// name: 'FetchError',
// message: 'request to https://graph.microsoft.com/v1.0/drive/root:/Apps/Joplin/.sync/7ee5dc04afcb414aa7c684bfc1edba8b.md_1499352102856 failed, reason: connect EAGAIN 65.52.64.250:443 - Local (0.0.0.0:54374)',