Skip to content

stuck in a reload loop #565

@CDU-Ge

Description

@CDU-Ge

Taskiq version

0.12.1

Python version

Python 3.12

OS

Linux

What happened?

In taskiq/cli/watcher.py, only the event types "opened" and "closed" were ignored. The "closed_no_write" event triggered an endless loop.

this is code:

class FileWatcher:  # pragma: no cover
    """Filewatcher that watches for filesystem changes."""
    ...
    def dispatch(self, event: FileSystemEvent) -> None:
        """
        React to event.

        This function checks whether we need to
        react to event and calls callback if we do.

        :param event: incoming fs event.
        """
        if event.is_directory:
            return
        if event.event_type in {"opened", "closed"}:
            return
        if ".git" in event.src_path:
            return
        try:
            if self.gitignore and self.gitignore(event.src_path):
                return
        except Exception as exc:
            logger.info(
                f"Cannot check path `{event.src_path!r}` in gitignore. Cause: {exc}",
            )
            return

        logger.debug(f"File changed. Event: {event}")
        self.callback(**self.callback_kwargs)

Relevant log output

Broker initialization code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions