-
Notifications
You must be signed in to change notification settings - Fork 249
Description
Hello,
On OS X I've noticed recursion is used when an event is received. So even though events are received on a per folder basis it will recurse into them. This means if you copy in a large tree of files, it will recurse the tree exponentially dependent on depth. For example a simple 1/2/3/4/5 would mean a recursion over the 4/5 layer 3 times. It also means a single change to a file in the root triggers a recursion of the entire watched folder. If the folder contains thousands of folders/files it will then delay the next change by up to 10-15 seconds sometimes in the tests I've done while the CPU sits at 100%.
Is there a reason for this recursion? Do any of the adapters (except poll) even need this at all?
(On a separate note - I notice recursion is implied... the actual recursive flag passed by the adapters isn't even referenced.)
There is one reason I can think - and that is if a new folder is added - it would need to Directory.scan it in order to process its contents, thus it would (kind of) need to recurse into it. This can easily be made a special case, and full recursion only performed if requested (by polling adapter for example.)
Does this make sense? Have I misunderstood the code?