Skip to content

Fix core indexer logging#481

Merged
schottra merged 2 commits into
mainfrom
flush-core-indexer-logs
Oct 16, 2025
Merged

Fix core indexer logging#481
schottra merged 2 commits into
mainfrom
flush-core-indexer-logs

Conversation

@schottra

Copy link
Copy Markdown
Contributor

Based on #258

Adds tick for syncing, sync on close, and fixes a couple of spots where we are direct exiting instead of returning an error and letting the outer loop panic().

My fault for not checking the AI's work hard enough the first time around :-D

Comment thread indexer/indexer.go

func (ci *CoreIndexer) Start(ctx context.Context) error {
sdk := sdk.NewAudiusdSDK(ci.Config.AudiusdURL)
go logging.SyncOnTicks(ctx, ci.logger, time.Second*10)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rickyrombo didn't i say something about the caller forgetting to do this 😤

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To balance the argument: I like the fiber model where it flushes at the end of the request using a middleware.
For indexing I think I may update this to flush after each block so we don't need to run a ticker at all.

But I do agree that this bit me and kept biting me and I didn't notice until I went to find the logs and found only bite marks.

@rickyrombo rickyrombo Oct 16, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like syncing on ticks is an antipattern that we're abusing in both indexers... but maybe it should be opt-out instead of opt-in tho?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What makes it an anti-pattern? I think there is probably value in flushing on a ticker if the code that's generating the logs may take a long time to reach whatever point it's flushing at. And it feels difficult to pick the right spot in forever loop that's processing events without just sprinkling calls to sync() in a bunch of places and hoping you don't miss somewhere important.
It also feels like it mimics the sidecar behavior you would expect elsewhere. I was surprised to learn that I had to manually flush these logs...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not an anti pattern but just kinda like a lazy workaround... Like, you wuldn't flushes SQL statements on a ticker. But it's logs so w/e

@schottra schottra merged commit e41bd03 into main Oct 16, 2025
5 checks passed
@schottra schottra deleted the flush-core-indexer-logs branch October 16, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants