Commit 104422b5 authored by martin hou's avatar martin hou

fix: 按照文件列表分包的数量去调整超时时长

parent 245d14e1
...@@ -703,6 +703,7 @@ Jensen.prototype.listFiles = async function () { ...@@ -703,6 +703,7 @@ Jensen.prototype.listFiles = async function () {
let self = this; let self = this;
// let tag = 'data_' + new Date().getTime(); // let tag = 'data_' + new Date().getTime();
this[tag] = []; this[tag] = [];
this[tag + '-ts'] = 0;
this.registerHandler(QUERY_FILE_LIST, (msg, jensen) => { this.registerHandler(QUERY_FILE_LIST, (msg, jensen) => {
console.log('tag', tag); console.log('tag', tag);
if (msg.body.length == 0) if (msg.body.length == 0)
...@@ -867,15 +868,15 @@ Jensen.prototype.listFiles = async function () { ...@@ -867,15 +868,15 @@ Jensen.prototype.listFiles = async function () {
{ {
return files.filter((f) => { return Boolean(f.time); }); return files.filter((f) => { return Boolean(f.time); });
} }
else if (fc > 0 && fc - files.length < 10) ts = 1000; jensen[tag + '-ts'] += 3000;
else ts = 15000; // console.log('ts, fc, files.length', ts, fc, files.length);
console.log('ts, fc, files.length', ts, fc, files.length);
jensen[kv] = window.setTimeout(() => { jensen[kv] = window.setTimeout(() => {
console.log('remove tag: ' + tag); console.log('remove tag: ' + tag);
jensen[tag] = null; jensen[tag] = null;
jensen._trigger(files.filter((f) => { return Boolean(f.time); }), QUERY_FILE_LIST); jensen._trigger(files.filter((f) => { return Boolean(f.time); }), QUERY_FILE_LIST);
console.log('jensen', 'list-files', 'timed return'); console.log('jensen', 'list-files', 'timed return');
}, ts); }, jensen[tag + '-ts']);
}); });
return this.send(new Command(QUERY_FILE_LIST)); return this.send(new Command(QUERY_FILE_LIST));
......
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