Commit Graph
13 Commits
Author SHA1 Message Date
Jon Ayers a6afcd046f fix: prevent deadlock between async error handling and failed subscribes (#27109) 2026-07-08 17:28:08 -05:00
Jon Ayers 40bceeaf8d fix: nats timing flakes (#26944) 2026-07-01 17:57:42 -05:00
Spike Curtis 98e1ce133c chore: modify replicasync to handle NATS explicitly (#26666)
relates to GRU-69

Modifies replicasync to handle discovering NATS enabled primary replicas explicitly, and passing that info to the NATS Pubsub.

This PR adds a new deployment value to explicitly represent the host or IP that the replica can be reached on. It isn't wired up to the CLI, but piggybacks on the DERP config for now.

We learn the NATS port directly from NATS at runtime, and propagate it thru replicasync to learn all peers for clustering.
2026-06-26 08:36:32 -04:00
Zach 953091c7bc refactor: use sync.WaitGroup.Go in tests (#26671)
Migrate `wg.Add(1); go func() { defer wg.Done(); ... }()` to
`wg.Go(func() { ... })` in tests.

Where the prior pattern passed the loop variable explicitly via a
closure parameter (`go func(id int) { ... }(i)`), drop the parameter and
reference the loop variable directly. Per-iteration loop variables since
Go 1.22 make this safe.
2026-06-25 15:41:09 -06:00
Callum StyanandMux 51591e3d59 fix(coderd/x/nats): default ClusterPort so cluster routes form (#26591)
Co-authored-by: Mux <mux@coder.com>
2026-06-23 10:03:48 -07:00
Jon Ayers 6da322d59f feat: add Prometheus metrics to NATS pubsub for parity with PGPubsub (#26441) 2026-06-23 11:59:48 -05:00
Spike Curtis 73acb2d5b4 test: accept 0 duration in TestAwaitDeliveryExactCount (#26582)
fixes https://github.com/coder/internal/issues/1603

On Windows you can get 0 duration from subsequent time.Now() calls.
2026-06-22 16:15:17 -04:00
Jon Ayers ea1379d42c chore: add nats benchmarking pkg (#26396) 2026-06-17 17:34:02 -05:00
Spike Curtis 21aa295fe4 chore: refactor NATS pubsub to use MsgQueue (#26197)
Closes https://github.com/coder/scaletest/issues/151  
Closes GRU-71  
  
Use the existing MsgQueue from the original PGPubsub instead of the 2-channel solution originally built here.

Renames `natsSub` to `groupSub`, since conceptually, a "NATS Subscription" already refers to the underlying subscription on the NATS server.

This PR also simplifies the closing of the PubSub to just close each `localSub`. When the last `localSub` for an event is closed, it unsubscribes and remove the `groupSub`. This ensures we go through the same code paths closing normally and at end of day.
2026-06-15 16:23:07 -04:00
Jon Ayers 1f8a8e8356 fix: fix flakiness in nats localsub test (#26084)
fixes https://github.com/coder/internal/issues/1552
2026-06-05 10:47:36 -05:00
Jon Ayers 167ac7b879 feat: add nats experiment (#25703) 2026-06-03 15:37:19 -05:00
Jon Ayers 5cdc9e28a9 feat: add nats cluster peer support (#25632) 2026-05-29 11:35:59 -05:00
Jon Ayers f6f284ea51 feat: add initial NATS implementation (#25602) 2026-05-27 12:57:20 -05:00