Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileWatcher should expose more awatch configuration options #146

Open
llucax opened this issue Aug 4, 2023 · 0 comments
Open

FileWatcher should expose more awatch configuration options #146

llucax opened this issue Aug 4, 2023 · 0 comments
Labels
part:core Affects the core types (`Sender`, `Receiver`, exceptions, etc.) type:enhancement New feature or enhancement visitble to users
Milestone

Comments

@llucax
Copy link
Contributor

llucax commented Aug 4, 2023

What's needed?

We need to have more flexibility to configure a FileWatcher. At the moment all watching is recursive and there is no way to set own filter and other options that are very useful to have.

Proposed solution

I see mainly 2 options that we might need to explore in more depth:

1. Making FileWatcher just a glue to use awatch with channels

This means, we just take a awatch instance in the FileWatcher configuration and we also use awatch's own event types, etc. This allows for full flexibility and zero(ish) maintenance cost for updating to new versions of awatch that could provide even more options.

The downside is stopping can't be taken care of by the FileWatcher, the users will have to provide an event themselves to stop, if they need to stop the receiver. Or maybe we can just use Task.cancel() to stop it.

2. Making FileWatcher expose more awatch options in the __init__

This means that we take in the __init__ an option to pass watch_filter, debounce, recursive and other options that will be just forwarded to awatch.

The downside is we always need to update if awatch if more features are added, and we need to create/maintain wrappers for other awatch types if we want to make the implementation hidden.


Since we are coupling FileWatcher with awatch anyways, and using a file watcher is not something that needs to be done very often (it is still a lowish-level construct) and has many things to consider, I lean more towards using the first approach.

Use cases

The main use case for now is the ConfigManagingActor in the SDK.

With the current FileWatcher implementation, the config manager needs to watch for a whole directory recursively just to watch for one individual file, and do the filtering manually, which is not ideal (and was difficult to understand what was going on).

Alternatives and workarounds

Use awatch directly or do some of the work manually.

Additional context

We are considering changing the underlying library, so we should have this in mind before addressing this issue:

@llucax llucax added part:❓ We need to figure out which part is affected priority:❓ We need to figure out how soon this should be addressed type:enhancement New feature or enhancement visitble to users part:core Affects the core types (`Sender`, `Receiver`, exceptions, etc.) and removed part:❓ We need to figure out which part is affected priority:❓ We need to figure out how soon this should be addressed labels Aug 4, 2023
@llucax llucax modified the milestones: v0.17.0, v1.0.0, v1.1.0 Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:core Affects the core types (`Sender`, `Receiver`, exceptions, etc.) type:enhancement New feature or enhancement visitble to users
Projects
Status: To do
Development

No branches or pull requests

2 participants