1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

More logging for CommandExecutor

This commit is contained in:
Mark McDowall 2015-06-02 00:18:34 -07:00
parent 49718fbfbe
commit aae3970865
3 changed files with 7 additions and 5 deletions

View File

@ -48,12 +48,12 @@ private void ExecuteCommands()
} }
catch (ThreadAbortException ex) catch (ThreadAbortException ex)
{ {
_logger.ErrorException(ex.Message, ex); _logger.ErrorException("Thread aborted: " + ex.Message, ex);
Thread.ResetAbort(); Thread.ResetAbort();
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex.Message, ex); _logger.Error("Unknown error in thread: " + ex.Message, ex);
} }
} }
@ -80,6 +80,7 @@ private void ExecuteCommand<TCommand>(TCommand command, CommandModel commandMode
} }
catch (CommandFailedException ex) catch (CommandFailedException ex)
{ {
_commandQueueManager.SetMessage(commandModel, "Failed");
_commandQueueManager.Fail(commandModel, ex.Message, ex); _commandQueueManager.Fail(commandModel, ex.Message, ex);
throw; throw;
} }

View File

@ -150,14 +150,15 @@ public void Requeue()
public void CleanCommands() public void CleanCommands()
{ {
_logger.Trace("Cleaning up old commands"); _logger.Trace("Cleaning up old commands");
_repo.Trim();
var old = _commandCache.Values.Where(c => c.EndedAt < DateTime.UtcNow.AddMinutes(5)); var old = _commandCache.Values.Where(c => c.EndedAt < DateTime.UtcNow.AddMinutes(5));
foreach (var command in old) foreach (var command in old)
{ {
_commandCache.Remove(command.Id.ToString()); _commandCache.Remove(command.Id.ToString());
} }
_repo.Trim();
} }
private dynamic GetCommand(string commandName) private dynamic GetCommand(string commandName)

View File

@ -77,7 +77,7 @@ public void Start(CommandModel command)
public void End(CommandModel command) public void End(CommandModel command)
{ {
SetFields(command, c => c.EndedAt, c => c.Status, c => c.Duration); SetFields(command, c => c.EndedAt, c => c.Status, c => c.Duration, c => c.Exception);
} }
} }
} }