feat: added --disable-size flag and related handling#246
feat: added --disable-size flag and related handling#246zaldih merged 2 commits intovoidcosmos:mainfrom
Conversation
|
Thanks for opening this PR! I've been reviewing it and found a bug: when The fix should keep calling |
| if (this.config.disableSize) { | ||
| this.scanSubscription = scan$.subscribe({ | ||
| next: () => this.printFoldersSection(), | ||
| error: (error) => this.newError(error), | ||
| complete: () => this.completeSearch(), | ||
| }); | ||
| } else { | ||
| this.scanSubscription = scan$ | ||
| .pipe( | ||
| mergeMap( | ||
| (nodeFolder) => this.scanService.calculateFolderStats(nodeFolder), | ||
| 10, // Limit to 10 concurrent stat calculations at a time | ||
| ), | ||
| tap((folder) => this.processFolderStatsForUi(folder)), | ||
| ) | ||
| .subscribe({ | ||
| next: () => this.printFoldersSection(), | ||
| error: (error) => this.newError(error), | ||
| complete: () => this.completeSearch(), | ||
| }); | ||
| } |
There was a problem hiding this comment.
Instead of branching here, keep callng calculateFolderStats always. Move the disableSize check inside that emthod so it skips only the size calculation but still computes modificationTime.
There was a problem hiding this comment.
@zaldih Alright, thanks for the review, I have done the required changes, now the age section works as expected, verified the same as well.
|
It works like a charm. Thank you so much for your contribution!! I'll work on this to hide the column if the option is enabled. The TUI is a bit tricky, so I'll take care of it myself. |
|
@zaldih Btw you should know I benchmarked this, and its like 17x faster with disable-size, seems like a good win for performance as expected. |
For #240
Changes
disableSizeto the CLI config interface and default config.--disable-sizeoption in CLI help/options.ResultsUiso result rendering can react todisableSize.calculateFolderStats()whendisableSizeis enabled.--delete-allhandling so folders can be deleted as soon as they are found when size calculation is disabled.disableSizefield.Validation
npm run buildpasses.npm testpasses.node lib/index.js --helpshows--disable-size.Note
--disable-sizecurrently affects interactive UI mode.