Skip to content

Dynamicly adjusting rust_timeout #328

@stumpylog

Description

@stumpylog

Description

I'm prototyping porting some code to watchfiles from inotify-simple which needs to wait until some X seconds have passed since an event against a file before taking action with that file.

I'm unsure how I can accomplish something similar with watchfiles. I think it would need changing rust_timeout in some dynamic way, to either 0 if no files are waiting or the max event time if files are waiting so they can be checked and potentially processed.

Is this possible? Is there a way to accomplish something like this, ideally without stopping the watching to do so?

PS: I would have made this a discussion, since it is clearly more just a question. Maybe consider opening those for the repo?

Example Code

The existing code I am evaluating transitioning:

https://github.com/paperless-ngx/paperless-ngx/blob/ab87aedfc75cb5072e31ce43253224d727e97771/src/documents/management/commands/document_consumer.py#L286-L359

Watchfiles Output

No response

Operating System & Architecture

x86_64

Environment

No response

Python & Watchfiles Version

3.11

Rust & Cargo Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions