Skip to content

Allow watching a file that didn't exist before#9

Open
davidthomaswood wants to merge 1 commit into
rbarrois:masterfrom
davidthomaswood:retry-watching-file
Open

Allow watching a file that didn't exist before#9
davidthomaswood wants to merge 1 commit into
rbarrois:masterfrom
davidthomaswood:retry-watching-file

Conversation

@davidthomaswood

Copy link
Copy Markdown

If a watch request fails because the file didn't exist, an OSError is
correctly raised, but the alias remains in the list of requests.
Therefore it isn't possible to catch the exception, and retry the watch
request once the file has been created.

This patch adds the watch request to the request queue after attempting
to call _setup_watch, to ensure it doesn't get left in the queue if
the setup fails.

If a watch request fails because the file didn't exist, an `OSError` is
correctly raised, but the alias remains in the list of requests.
Therefore it isn't possible to catch the exception, and retry the watch
request once the file has been created.

This patch adds the watch request to the request queue after attempting
to call `_setup_watch`, to ensure it doesn't get left in the queue if
the setup fails.
@albertodonato

Copy link
Copy Markdown

I think the same should be done in the unwatch() method.
If a watched file is removed, it's not possible to unwatch it because the kernel will raise an OSError. In that case, the request is left around and you can't watch() the file again later.

@albertodonato

Copy link
Copy Markdown

What I described seems to be a similar issue to the one mentioned in #2

@albertodonato

Copy link
Copy Markdown

@rbarrois hi, any chance this could be merged?

@spumer

spumer commented Mar 26, 2020

Copy link
Copy Markdown

Any updates?

@fpemud

fpemud commented Nov 25, 2020

Copy link
Copy Markdown

Is this project dead? no action for years.

@spumer

spumer commented Nov 25, 2020

Copy link
Copy Markdown

I copy original module and apply all PR changes for my copy. All works fine, but this really sad when i see no progress all this time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants