Skip to content

[Bug]: Postgres Reactive FromListen continues after OnError #216

Description

@Skymly

Solution module

Postgres

Parent

#212 (item 2)
#215 (grilled: no Shared pump / helper)

What happened?

Postgres Reactive FromListen / FromListen<T> uses synchronous Observable.Create and fire-and-forget RunAsync. Typed FromListen<T> calls observer.OnError in the notification handler on deserialize failure but does not cancel the listen loop, so WaitAsync can still deliver OnNext / OnCompleted after OnError (Rx contract).

What I expected

A hot LISTEN stream uses System.Reactive Observable.Create(Func<IObserver<T>, CancellationToken, Task>) (same shape as R3). After OnError, the subscription stops: no further notifications, listen loop cancelled, UNLISTEN still runs.

Agreed fix (grilled)

  • Switch Reactive hot listen to Rx async Create. Dispose cancels the token Rx already passes in.
  • On deserialize failure in FromListen<T>, error the observer and stop the pump (cancel / leave WaitAsync).
  • Do not change R3 OnErrorResume (different backend contract).
  • One PR, Postgres module only.

Out of this ticket

Shared subscribe-pump extraction (declined on #215). Other Features' pumps.

Acceptance

  • Reactive FromListen / FromListen<T> subscribe via Rx async Create.
  • After a deserialize OnError on FromListen<T>, no further OnNext / OnCompleted.
  • Dispose still UNLISTENs (best-effort, as today).
  • dotnet test Postgres.Tests / Postgres.Reactive.Tests / Postgres generator tests still pass.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingready-for-agentSpec/PRD ready for agent implementation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions