Skip to content

Commit 51e753b

Browse files
authored
Fixed windos fs-discover (#77)
1 parent 70fe23e commit 51e753b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

taskiq/cli/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ def import_tasks(modules: List[str], pattern: str, fs_discover: bool) -> None:
8181
"""
8282
if fs_discover:
8383
for path in Path(".").rglob(pattern):
84-
modules.append(str(path).removesuffix(".py").replace("/", "."))
84+
modules.append(str(path).removesuffix(".py").replace(os.path.sep, "."))
8585

8686
import_from_modules(modules)

taskiq/cli/watcher.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(
2424
self.gitignore = parse_gitignore(gpath)
2525
self.callback_kwargs = callback_kwargs
2626

27-
def dispatch(self, event: FileSystemEvent) -> None:
27+
def dispatch(self, event: FileSystemEvent) -> None: # noqa: C901
2828
"""
2929
React to event.
3030
@@ -39,7 +39,14 @@ def dispatch(self, event: FileSystemEvent) -> None:
3939
return
4040
if ".git" in event.src_path:
4141
return
42-
if self.gitignore and self.gitignore(event.src_path):
42+
try:
43+
if self.gitignore and self.gitignore(event.src_path):
44+
return
45+
except Exception as exc:
46+
logger.info(
47+
f"Cannot check path `{event.src_path}` in gitignore. Cause: {exc}",
48+
)
4349
return
50+
4451
logger.debug(f"File changed. Event: {event}")
4552
self.callback(**self.callback_kwargs)

0 commit comments

Comments
 (0)