Uh oh!
There was an error while loading. Please reload this page.
[API-321] Migrate tests for blast writes - #342
Conversation
| ($1, $2, $3, $4, $5) | ||
| on conflict do nothing | ||
| `, trashid.BlastMessageID(blast.BlastID, params.ChatID), params.ChatID, blast.FromUserID, blast.CreatedAt, blast.BlastID) | ||
| `, messageId, params.ChatID, blast.FromUserID, blast.CreatedAt.UTC(), blast.BlastID) |
There was a problem hiding this comment.
Note here the usage of .UTC(). On my machine, when running this, the location() on this time.Time was being set to Local and that was causing us to insert messages in the past. Since chat_blast uses a timestamptz column type and chat_message uses a plain timestamp column type, pgx semantics when inserting will cause it to try and map from the timezone in the incoming variable to the timezone of the machine running postgres.
Kind of gnarly 😬
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| }) | ||
| } | ||
| /* TODO: |
There was a problem hiding this comment.
I didn't think writing them would add a ton of value for the amount of time it would take. Can be persuaded though :-p
Uh oh!
There was an error while loading. Please reload this page.
#941) ## Summary Bumps `go-openaudio` to `aee578e` (OpenAudio/go-openaudio#342) and wires the **core-indexer** to source blocks from the `CoreService.StreamBlocks` **gRPC stream** instead of polling `GetBlocks`, behind a new `coreBlockStreamEnabled` env — **default off**, so prod behavior is unchanged until flipped. ## What #342 gives us The ETL can now consume blocks over a gRPC server stream: the node replays history from the resume height, then live-tails, gap-filling any heights its in-process pubsub drops. The ETL reconnects from its cursor on error and **auto-falls-back to polling** if the endpoint doesn't support the stream. ## Changes - `go.mod`/`go.sum`: `github.com/OpenAudio/go-openaudio` (+ `/pkg/etl`) → `v1.3.1-0.20260609211151-aee578ec923b` - `config/config.go`: new `CoreBlockStreamEnabled` (`coreBlockStreamEnabled` env, default off) - `indexer/indexer.go`: when enabled, set `Config.BlockStreamEnabled` and pass a gRPC (`connect.WithGRPC`) Core client via `SetBlockStreamClient`. The SDK's unary Core client is retained for status checks + the polling fallback. ## Rollout 1. Merge with the flag **unset** → no behavior change (still polling). 2. Set `coreBlockStreamEnabled=true` on **one** indexer and validate: it tails live, resumes gap-free on restart, and (induced) stream errors fall back to polling cleanly. 3. The one open question is whether the prod LB/ingress in front of the validator passes long-lived h2 gRPC streams — this single-indexer step is where that gets confirmed. If it doesn't, leave the flag off; polling is unaffected. Validated locally with the harness in OpenAudio/go-openaudio#344 (devnet, `--stream`, catch-up + restart-resume). ## Test plan - [x] `go mod tidy` (only go.mod/go.sum), `go build ./...`, `go vet ./indexer ./config` clean - [ ] Staging: flip `coreBlockStreamEnabled=true` on one indexer; confirm live-tail + gap-free restart + fallback 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This is a followup to #338 to migrate the quite sizable blasts test file. Source is here: https://github.com/AudiusProject/audius-protocol/blob/ab73d979f98e151ac0aa408c7a82c105c3b6355e/comms/discovery/rpcz/chat_blast_test.go#L760
getNewBlastsin the comms directory to match the one we use in the get endpoint. We are being intentionally WET here.As a bonus, also cleaned up the tests from the previous PR to match the patterns here.