1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Desktop: Fixes #4305: Fixed infinite sync issue with OneDrive

- Disable support for unreliable OneDrive delta sync, and switched to basic sync
- More robust error handling to take into account how unreliable the OneDrive API became
This commit is contained in:
Laurent Cozic
2021-01-20 15:49:02 +00:00
parent b74b849830
commit 8d35298500
10 changed files with 138 additions and 110 deletions

View File

@@ -1,4 +1,5 @@
const moment = require('moment');
const { basicDelta } = require('./file-api');
const { dirname, basename } = require('./path-utils');
const shim = require('./shim').default;
const Buffer = require('buffer').Buffer;
@@ -83,10 +84,12 @@ class FileApiDriverOneDrive {
context: null,
}, options);
let query = this.itemFilter_();
let query = Object.assign({}, this.itemFilter_(), { '$top': 1000 });
let url = `${this.makePath_(path)}:/children`;
if (options.context) {
// If there's a context, it already includes all required query
// parameters, including $top
query = null;
url = options.context;
}
@@ -213,6 +216,24 @@ class FileApiDriverOneDrive {
}
async delta(path, options = null) {
const getDirStats = async path => {
let items = [];
let context = null;
while (true) {
const result = await this.list(path, { includeDirs: false, context: context });
items = items.concat(result.items);
context = result.context;
if (!result.hasMore) break;
}
return items;
};
return await basicDelta(path, getDirStats, options);
}
async delta_BROKEN(path, options = null) {
const output = {
hasMore: false,
context: {},