Skip to content

Commit 7c40222

Browse files
s3riusuhx
authored andcommitted
Updated error notification on scheduler error. (#581)
1 parent 27356e3 commit 7c40222

3 files changed

Lines changed: 8 additions & 21 deletions

File tree

taskiq/abc/broker.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from taskiq.result_backends.dummy import DummyResultBackend
3030
from taskiq.serializers.json_serializer import JSONSerializer
3131
from taskiq.state import TaskiqState
32-
from taskiq.utils import maybe_awaitable, remove_suffix
32+
from taskiq.utils import maybe_awaitable
3333
from taskiq.warnings import TaskiqDeprecationWarning
3434

3535
if sys.version_info >= (3, 11):
@@ -317,10 +317,9 @@ def inner(
317317
fmodule = func.__module__
318318
if fmodule == "__main__": # pragma: no cover
319319
fmodule = ".".join(
320-
remove_suffix(
321-
os.path.normpath(sys.argv[0]),
322-
".py",
323-
).split(os.path.sep),
320+
os.path.normpath(sys.argv[0])
321+
.removesuffix(".py")
322+
.split(os.path.sep),
324323
)
325324
fname = func.__name__
326325
if fname == "<lambda>":

taskiq/cli/scheduler/run.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ async def get_schedules(source: ScheduleSource) -> list[ScheduledTask]:
4848
try:
4949
return await source.get_schedules()
5050
except Exception as exc:
51-
logger.warning(
52-
"Cannot update schedules with source: %s",
51+
logger.error(
52+
"Cannot update schedules with source: %s\n%s{}",
5353
source,
54+
exc,
55+
exc_info=True,
5456
)
55-
logger.debug(exc, exc_info=True)
5657
return []
5758

5859

taskiq/utils.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,3 @@ async def maybe_awaitable(
2929
if inspect.isawaitable(possible_coroutine):
3030
return await possible_coroutine
3131
return possible_coroutine # type: ignore
32-
33-
34-
def remove_suffix(text: str, suffix: str) -> str:
35-
"""
36-
Removing a Suffix from a String with a Custom Function.
37-
38-
:param text: String
39-
:param suffix: Removing a Suffix
40-
:return: value.
41-
"""
42-
if text.endswith(suffix):
43-
return text[: -len(suffix)]
44-
return text

0 commit comments

Comments
 (0)