Guard GetIndexer against null mapping and complete Equals comparison

Avoid calling GetIndexer with ID 0 when no mapping exists. Add
Capabilities, TimeoutSeconds, LimitDefault, and LimitMax to the
Equals check so changes to those fields trigger sync updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
nitrobass24 2026-04-15 00:30:22 -05:00
parent 9287eaede0
commit 8350120673
2 changed files with 10 additions and 1 deletions

View file

@ -114,7 +114,9 @@ public override void UpdateIndexer(IndexerDefinition indexer, bool forceSync = f
var quiIndexer = BuildQuiIndexer(indexer, indexerCapabilities, indexerMapping?.RemoteIndexerId ?? 0);
var remoteIndexer = _quiProxy.GetIndexer(indexerMapping?.RemoteIndexerId ?? 0, Settings);
var remoteIndexer = indexerMapping?.RemoteIndexerId > 0
? _quiProxy.GetIndexer(indexerMapping.RemoteIndexerId, Settings)
: null;
if (remoteIndexer != null)
{

View file

@ -71,13 +71,20 @@ public bool Equals(QuiIndexer other)
var thisCategories = (Categories ?? Enumerable.Empty<QuiCategory>()).Select(c => c.CategoryId).OrderBy(c => c);
var otherCategories = (other.Categories ?? Enumerable.Empty<QuiCategory>()).Select(c => c.CategoryId).OrderBy(c => c);
var thisCapabilities = (Capabilities ?? Enumerable.Empty<string>()).OrderBy(c => c);
var otherCapabilities = (other.Capabilities ?? Enumerable.Empty<string>()).OrderBy(c => c);
return other.BaseUrl == BaseUrl &&
other.ApiKey == ApiKey &&
other.Name == Name &&
other.Backend == Backend &&
other.Enabled == Enabled &&
other.Priority == Priority &&
other.TimeoutSeconds == TimeoutSeconds &&
other.LimitDefault == LimitDefault &&
other.LimitMax == LimitMax &&
other.IndexerId == IndexerId &&
otherCapabilities.SequenceEqual(thisCapabilities) &&
otherCategories.SequenceEqual(thisCategories);
}