fix
This commit is contained in:
@@ -8,25 +8,16 @@ namespace Managing.Application.ManageBot;
|
||||
public class DeleteBotCommandHandler : IRequestHandler<DeleteBotCommand, bool>
|
||||
{
|
||||
private readonly ILogger<DeleteBotCommandHandler> _log;
|
||||
private readonly ITaskCache _taskCache;
|
||||
private readonly IBotService _botService;
|
||||
|
||||
public DeleteBotCommandHandler(ITaskCache taskCache, ILogger<DeleteBotCommandHandler> log)
|
||||
public DeleteBotCommandHandler(ILogger<DeleteBotCommandHandler> log, IBotService botService)
|
||||
{
|
||||
_taskCache = taskCache;
|
||||
_log = log;
|
||||
_botService = botService;
|
||||
}
|
||||
|
||||
public Task<bool> Handle(DeleteBotCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
_taskCache.Invalidate(request.Name);
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.LogError(e.Message);
|
||||
return Task.FromResult(false);
|
||||
}
|
||||
return _botService.DeleteBot(request.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user