Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
using: "composite"
steps:
- name: Install UV
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ inputs.python-version }}

Expand Down
23 changes: 5 additions & 18 deletions cq/_core/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,18 @@
)


@injection.singleton(
on=CommandBus,
ignore_type_hint=True, # type: ignore[call-arg]
inject=False,
mode="fallback",
)
def new_command_bus[T]() -> CommandBus[T]:
@injection.singleton(inject=False, mode="fallback")
def new_command_bus() -> CommandBus: # type: ignore[type-arg]
bus = SimpleBus(command_handler.manager)
bus.add_middlewares(InjectionScopeMiddleware(CQScope.ON_COMMAND))
return bus


@injection.singleton(
inject=False,
mode="fallback",
)
@injection.singleton(inject=False, mode="fallback")
def new_event_bus() -> EventBus:
return TaskBus(event_handler.manager)


@injection.singleton(
on=QueryBus,
ignore_type_hint=True, # type: ignore[call-arg]
inject=False,
mode="fallback",
)
def new_query_bus[T]() -> QueryBus[T]:
@injection.singleton(inject=False, mode="fallback")
def new_query_bus() -> QueryBus: # type: ignore[type-arg]
return SimpleBus(query_handler.manager)
4 changes: 2 additions & 2 deletions cq/middlewares/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ async def __call__(self, *args: Any, **kwargs: Any) -> MiddlewareResult[Any]:
try:
yield

except self.__exceptions as exc:
except self.__exceptions:
if attempt == retry:
raise exc
raise

else:
break
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def __call__(self, /, *args: Any, **kwargs: Any) -> MiddlewareResult[Any]:
result = yield
except BaseException as exc:
record = HistoryRecord(args, kwargs, exc, HistoryRecordStatus.FAILED)
raise exc
raise
else:
record = HistoryRecord(args, kwargs, result, HistoryRecordStatus.SUCCESS)
finally:
Expand Down
Loading