Refactor to support batch action invocation

Replaced `InvokeRecAction` with `InvokeBatchRecAction` in `ActionController` to transition from single-action to batch-action invocation.

Removed `InvokeRecActionCommand.cs`, which previously handled individual action invocations. Introduced `InvokeBatchRecActionsCommand.cs` to handle batch processing with similar concurrency control logic using a semaphore.

This redesign improves scalability and aligns with updated business requirements while maintaining compatibility with the existing application structure.
This commit is contained in:
2025-11-27 11:05:21 +01:00
parent cb851a4ec6
commit 0ec913b95e
2 changed files with 7 additions and 7 deletions

View File

@@ -4,17 +4,17 @@ using ReC.Application.RecActions.Queries;
namespace ReC.Application.RecActions.Commands;
public record InvokeRecActionCommand : ReadRecActionQueryBase, IRequest;
public record InvokeBatchRecActionsCommand : ReadRecActionQueryBase, IRequest;
public static class InvokeRecActionCommandExtensions
public static class InvokeBatchRecActionsCommandExtensions
{
public static Task InvokeRecAction(this ISender sender, int profileId)
=> sender.Send(new InvokeRecActionCommand { ProfileId = profileId });
public static Task InvokeBatchRecAction(this ISender sender, int profileId)
=> sender.Send(new InvokeBatchRecActionsCommand { ProfileId = profileId });
}
public class InvokeRecActionCommandHandler(ISender sender, IHttpClientFactory clientFactory, ILogger<InvokeRecActionCommandHandler>? logger = null) : IRequestHandler<InvokeRecActionCommand>
public class InvokeRecActionsCommandHandler(ISender sender, IHttpClientFactory clientFactory, ILogger<InvokeRecActionsCommandHandler>? logger = null) : IRequestHandler<InvokeBatchRecActionsCommand>
{
public async Task Handle(InvokeRecActionCommand request, CancellationToken cancel)
public async Task Handle(InvokeBatchRecActionsCommand request, CancellationToken cancel)
{
var actions = await sender.Send(request.ToReadQuery(), cancel);