find-remove icon indicating copy to clipboard operation
find-remove copied to clipboard

Odd behavior with limit

Open hardysabs2 opened this issue 3 years ago • 2 comments

const result = findRemoveSync(process.env.LOG_BASE_DIR, {
  age: { seconds: process.env.SECONDS_TO_RETAIN_LOG_FILES },
  extensions: ".log",
  limit: 100
});

the base dir has multiple directories under it and the log files are under those. If I have counted right there are around 94 files scattered amongst sub-folders, all *.log, definitely not many more than 100 if at all. All old than the 20s set and it seems to take 2 goes to delete all the files.

I have checked around to see that none of the files are open anywhere. Is there anything else that I may be doing wrong that may be causing this? What is the behavior if it fails to delete one file, will it still go on to delete the others?

Thanks

hardysabs2 avatar Feb 24 '22 13:02 hardysabs2

Thanks for bringing this to my attention.

Busy family father here. If you could fork this repository, display this problem in a new failing unit test case, that would be great :)

binarykitchen avatar Feb 25 '22 06:02 binarykitchen

I think we already have some unit tests toward the end covering some deeply, nested random files. Have a look. I hope this helps.

binarykitchen avatar Feb 25 '22 06:02 binarykitchen