Skip to content

Polecat primary IEventStore bridge registers twice — GetServices<IEventStore>() yields the same DocumentStore instance two times #3365

Description

@jeremydmiller

Small one, found writing the CritterWatch pin test for #3219 (whose ancillary fix works as designed).

A minimal Solo host:

opts.Services.AddPolecat(m => { ... }).IntegrateWithWolverine();
opts.Services.AddPolecatStore<ICritterWatchStore>(m => { ... }).IntegrateWithWolverine();

yields THREE IEventStore registrations — the primary Polecat.DocumentStore appears twice (reference-equal, same hash), plus the ancillary once:

Polecat.DocumentStore          hash=66385004
Polecat.DocumentStore          hash=66385004   ← duplicate
ICritterWatchStoreImplementation hash=14267127

Impact is minor but real for anything iterating GetServices<IEventStore>(): CritterWatch's EventProgressionPoller polls the primary store twice per pass (duplicate progression reads + duplicate snapshots posted), and duplicate-sensitive counts (stores.Count) are off by one. Wolverine.Polecat 6.17.1, Polecat 4.8.0.

Likely the WolverineOptionsPolecatExtensions primary bridge (AddSingleton<IEventStore>(s => (IEventStore)s.GetRequiredService<IDocumentStore>())) executing twice — once from the explicit IntegrateWithWolverine() and once from an internal integration pass. TryAdd-style registration (or an enumerable-dedupe) would fix it either way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions