Skip to content

Commit

Permalink
Merge pull request #111 from neuroglia-io/fix-redis-roa-watch
Browse files Browse the repository at this point in the history
Fix the RedisDatabase to properly filter watch events
  • Loading branch information
cdavernas authored Aug 30, 2024
2 parents 1773c26 + e7d67dd commit 0170495
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public virtual async Task<IResourceWatch> WatchResourcesAsync(string group, stri
if (string.IsNullOrWhiteSpace(version)) throw new ArgumentNullException(nameof(version));
if (string.IsNullOrWhiteSpace(plural)) throw new ArgumentNullException(nameof(plural));
var resourceDefinition = await this.GetDefinitionAsync(group, plural, cancellationToken).ConfigureAwait(false) ?? throw new ProblemDetailsException(ResourceProblemDetails.ResourceDefinitionNotFound(new ResourceDefinitionReference(group, version, plural)));
var observable = this.ResourceWatchEvents.Where(e => e.Resource.GetGroup() == group && e.Resource.GetVersion() == version && e.Resource.Kind == resourceDefinition.Spec.Names.Kind && string.IsNullOrWhiteSpace(@namespace) || e.Resource.GetNamespace() == @namespace);
var observable = this.ResourceWatchEvents.Where(e => e.Resource.GetGroup() == group && e.Resource.GetVersion() == version && e.Resource.Kind == resourceDefinition.Spec.Names.Kind && (string.IsNullOrWhiteSpace(@namespace) || e.Resource.GetNamespace() == @namespace));
if (labelSelectors?.Any() == true) observable = observable.Where(e => labelSelectors.All(s => s.Selects(e.Resource)));
return new ResourceWatch(observable, false);
}
Expand Down

0 comments on commit 0170495

Please sign in to comment.