appsody / controller

Appsody controller running in the development container. This repo will be archived soon.
https://appsody.dev
Apache License 2.0
2 stars 12 forks source link

Controller and watcher interaction needs to allow preprocessing of ignored events #24

Closed kewegner closed 5 years ago

kewegner commented 5 years ago

Currently the controller limits the number of events it gets back to 1 per watch cycle. This was originally done to cut down on the number of ON_CHANGE actions performed per cycle. Unfortunately, this can cause some events which the stack does not consider "ON_CHANGE" events to be processed, and others which would be ON_CHANGE actions to be skipped.

Most of the stacks have APPSODY_REGEX expressions which effectively exclude directory events, so the limit of one event causes only file events of interest to be reported back. So the limit of 1 works to a fair degree in those scenarios.

Currently the REGEX is used to match against the filename or the leaf directory name.

The java-spring-boot2 stack has a REGEX that match on almost everything, and thus the directory events are not filtered out. The other stacks filter out the directory events for the normal/majority of case(s), because their REGEX requires the name to end with a file extension.

Update:

We believe the one event limit is valid as long as all the events are valid events. Therefore we do not want the controller to do any post processing of events, all matching of events needs to happen in the watcher.

The solution is this:

  1. Create a FilterHook for the watcher that ignores any events related to APPSODY_IGNORE_DIR
  2. Create a FilterHook for the watcher that ignores any directory events. The above require folking the watcher repo to add the new Filters.

As part of the work above, we can make two improvements:

  1. Move the setting of the regex expression on the watcher prior to defining the watchers watch directories
  2. Remove the controller post processing step on event.Name for non ignored events, (this was needed for a specific scenario for node based stacks, which moving the REGEX set on tthe watcher eliminates the need for).
kewegner commented 5 years ago

@neeraj-laad @kylegc In the fix I am working on, it will ignore the directory events as we discussed. Changing to full path regex would not have totally eliminated the issue Ozzie had initially. There is a separate issue for addressing regex of full path vs. file-name/directory name.