mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-24 15:20:21 +08:00
dev: track ll_readshares depth
This commit is contained in:
parent
249dc06201
commit
caf8d2a055
@ -33,12 +33,13 @@ class LLReadShares extends LLFilesystemOperation {
|
|||||||
|
|
||||||
async _run () {
|
async _run () {
|
||||||
const results = [];
|
const results = [];
|
||||||
await this.recursive_part(results, this.values);
|
const stats = await this.recursive_part(results, this.values);
|
||||||
|
// console.log('LL_READ_SHARES_STATS !!!!!', stats);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
async recursive_part (results, { subject, user, actor }) {
|
async recursive_part (results, { subject, user, actor, depth = 0 }) {
|
||||||
actor = actor || Context.get('actor');
|
actor = actor || Context.get('actor');
|
||||||
const ll_readdir = new LLReadDir();
|
const ll_readdir = new LLReadDir();
|
||||||
const children = await ll_readdir.run({
|
const children = await ll_readdir.run({
|
||||||
@ -73,11 +74,15 @@ class LLReadShares extends LLFilesystemOperation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const p = this.recursive_part(results, {
|
const p = this.recursive_part(results, {
|
||||||
subject: child, user });
|
subject: child,
|
||||||
|
user,
|
||||||
|
depth: depth + 1,
|
||||||
|
});
|
||||||
promises.push(p);
|
promises.push(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(promises);
|
const stats = await Promise.all(promises);
|
||||||
|
return Math.max(depth, ...stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user