Commit e5fc46f8 authored by martin hou's avatar martin hou

fix: 按照缺少的文件数量决定超时等待时长

parent 384de44f
......@@ -688,15 +688,13 @@ Jensen.prototype.listFiles = async function () {
let tag = 'filelist-' + this.serialNumber + '-' + this.sequence();
if (this[tag] != null) return null;
/*
let fc = null;
if (typeof this.versionNumber == 'undefined' || this.versionNumber <= 327722) {
fc = await this.getFileCount(5);
if (fc == null) return null;
if (fc == null) return [];
}
if (fc && fc.count == 0) return null;
*/
if (fc && fc.count == 0) return [];
let self = this;
// let tag = 'data_' + new Date().getTime();
......@@ -860,13 +858,20 @@ Jensen.prototype.listFiles = async function () {
}
jensen[kv] = now;
let ts = 2500;
// 如果差的数量还比较多,那就多等一会儿
if (fc == files.length)
{
return files.filter((f) => { return Boolean(f.time); });
}
else if (fc - files.length < 10) fc = 1000;
else fc = 15000;
jensen[kv] = window.setTimeout(() => {
console.log('remove tag: ' + tag);
jensen[tag] = null;
jensen._trigger(files.filter((f) => { return Boolean(f.time); }), QUERY_FILE_LIST);
console.log('jensen', 'list-files', 'timed return');
}, 2500);
}, ts);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment