Skip to content

Commit a708d91

Browse files
committed
Merge tag '0.0.3' into develop
0.0.3
2 parents 4f0e0a0 + eeac576 commit a708d91

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ extend-ignore = E203
66
docstring_style=sphinx
77

88
ignore =
9+
; Found a line that starts with a dot
10+
WPS348,
911
; `noqa` comments overuse ))))
1012
WPS402,
1113
; Found `%` string formatting

taskiq/abc/broker.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import inspect
2+
import os
3+
import sys
24
from abc import ABC, abstractmethod
35
from functools import wraps
46
from logging import getLogger
@@ -187,9 +189,18 @@ def inner(
187189
) -> AsyncTaskiqDecoratedTask[_FuncParams, _ReturnType]:
188190
nonlocal inner_task_name # noqa: WPS420
189191
if inner_task_name is None:
190-
inner_task_name = ( # noqa: WPS442
191-
f"{func.__module__}:{func.__name__}"
192-
)
192+
fmodule = func.__module__
193+
if fmodule == "__main__":
194+
fmodule = ".".join( # noqa: WPS220
195+
sys.argv[0]
196+
.removesuffix(
197+
".py",
198+
)
199+
.split(
200+
os.path.sep,
201+
),
202+
)
203+
inner_task_name = f"{fmodule}:{func.__name__}" # noqa: WPS442
193204
wrapper = wraps(func)
194205

195206
decorated_task = wrapper(

taskiq/cli/worker.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ async def shutdown_broker(broker: AsyncBroker, timeout: float) -> None:
153153
)
154154

155155

156-
def start_listen(args: TaskiqArgs) -> None: # noqa: C901, WPS213
156+
def start_listen(args: TaskiqArgs) -> None: # noqa: C901
157157
"""
158158
This function starts actual listening process.
159159
@@ -209,9 +209,7 @@ def interrupt_handler(_signum: int, _frame: Any) -> None:
209209
loop.run_until_complete(async_listen_messages(broker, args))
210210
except KeyboardInterrupt:
211211
logger.warning("Worker process interrupted.")
212-
except Exception as exc:
213-
logger.error("Exception found: %s", exc, exc_info=True)
214-
loop.run_until_complete(shutdown_broker(broker, args.shutdown_timeout))
212+
loop.run_until_complete(shutdown_broker(broker, args.shutdown_timeout))
215213

216214

217215
def watch_workers_restarts(args: TaskiqArgs) -> None:

0 commit comments

Comments
 (0)