Skip to content

Commit

Permalink
Fixed: Task progress messages in the UI
Browse files Browse the repository at this point in the history
(cherry picked from commit c6417337812f3578a27f9dc1e44fdad80f557271)

Closes #3370
  • Loading branch information
markus101 authored and mynameisbogdan committed Mar 22, 2024
1 parent 11eda3b commit 37a9f67
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/NzbDrone.Core/Books/Commands/RefreshAuthorCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ public RefreshAuthorCommand(int? authorId, bool isNewAuthor = false)
public override bool SendUpdatesToClient => true;

public override bool UpdateScheduledTask => !AuthorId.HasValue;

public override string CompletionMessage => "Completed";
}
}
2 changes: 2 additions & 0 deletions src/NzbDrone.Core/Books/Commands/RefreshBookCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ public RefreshBookCommand(int? bookId)
public override bool SendUpdatesToClient => true;

public override bool UpdateScheduledTask => !BookId.HasValue;

public override string CompletionMessage => "Completed";
}
}
2 changes: 1 addition & 1 deletion src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private async Task<List<DownloadDecision>> Dispatch(Func<IIndexer, Task<IList<Re

var reports = batch.SelectMany(x => x).ToList();

_logger.Debug("Total of {0} reports were found for {1} from {2} indexers", reports.Count, criteriaBase, indexers.Count);
_logger.ProgressDebug("Total of {0} reports were found for {1} from {2} indexers", reports.Count, criteriaBase, indexers.Count);

// Update the last search time for all albums if at least 1 indexer was searched.
if (indexers.Any())
Expand Down
1 change: 0 additions & 1 deletion src/NzbDrone.Core/Indexers/RssSyncCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace NzbDrone.Core.Indexers
public class RssSyncCommand : Command
{
public override bool SendUpdatesToClient => true;

public override bool IsLongRunning => true;
}
}
2 changes: 1 addition & 1 deletion src/NzbDrone.Core/Messaging/Commands/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public virtual bool SendUpdatesToClient
}

public virtual bool UpdateScheduledTask => true;
public virtual string CompletionMessage => "Completed";
public virtual string CompletionMessage => null;
public virtual bool RequiresDiskAccess => false;
public virtual bool IsExclusive => false;
public virtual bool IsTypeExclusive => false;
Expand Down
16 changes: 13 additions & 3 deletions src/NzbDrone.Core/ProgressMessaging/ProgressMessageContext.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using System;
using System;
using System.Threading;
using NzbDrone.Core.Messaging.Commands;

namespace NzbDrone.Core.ProgressMessaging
{
public static class ProgressMessageContext
{
private static AsyncLocal<CommandModel> _commandModelAsync = new AsyncLocal<CommandModel>();

[ThreadStatic]
private static CommandModel _commandModel;

Expand All @@ -13,8 +16,15 @@ public static class ProgressMessageContext

public static CommandModel CommandModel
{
get { return _commandModel; }
set { _commandModel = value; }
get
{
return _commandModel ?? _commandModelAsync.Value;
}
set
{
_commandModel = value;
_commandModelAsync.Value = value;
}
}

public static bool LockReentrancy()
Expand Down
2 changes: 0 additions & 2 deletions src/NzbDrone.Core/Update/Commands/ApplicationUpdateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ public class ApplicationUpdateCommand : Command
{
public override bool SendUpdatesToClient => true;
public override bool IsExclusive => true;

public override string CompletionMessage => null;
}
}

0 comments on commit 37a9f67

Please sign in to comment.