Skip to content

client: Rework network request retries#492

Open
adamvy wants to merge 8 commits intomainfrom
adam/codex/PLAT-36147-reset-retry
Open

client: Rework network request retries#492
adamvy wants to merge 8 commits intomainfrom
adam/codex/PLAT-36147-reset-retry

Conversation

@adamvy
Copy link
Copy Markdown
Contributor

@adamvy adamvy commented Apr 22, 2026

Add a simple trigger using exsync.Event to abort and retry network requests.

Before this logic was somewhat split between beeper internal code and mautrix/go. This resulting a lot of redundant book-keeping on the beeper side to interact nicely with mautrix.

New logic here moves the per-request context creation into mautrix directly hooked into the retry logic. The new logic only applies if a RequestRetryTrigger is provided.

Also included are a bunch of ai generated tests, but happy to remove or simplify them if you want.

Beeper side of this is https://github.com/beeper/beeper/pull/2466

@adamvy adamvy changed the title [codex] add request retry trigger for resets Rework network request retries Apr 22, 2026
@adamvy adamvy marked this pull request as ready for review April 22, 2026 20:51
@adamvy adamvy requested a review from tulir April 22, 2026 20:51
Comment thread client.go Outdated
})
}

resetChan := cli.RequestRetryTrigger.GetChan()
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.

I suppose I could just do RequestRetryTrigger.Wait(attemptCtx) in the goroutine?

Comment thread client.go Outdated

RequestRetryTrigger *exsync.Event

// Deprecated: this hook is no longer used by mautrix internals and is kept only
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.

I suppose we could just delete this and consumers can either upgrade to the new behaviour, or just drop the functionality entirely.

Is anyone outside beeper using this atm?

Comment thread client.go Outdated
Comment thread client.go Outdated
Comment thread client.go Outdated
adamvy and others added 2 commits April 22, 2026 15:45
Co-authored-by: Tulir Asokan <tulir@maunium.net>
Co-authored-by: Tulir Asokan <tulir@maunium.net>
@adamvy
Copy link
Copy Markdown
Contributor Author

adamvy commented Apr 22, 2026

I suppose an alternative would be to just do this all at the sdk layer and not involve mautrix at all? LIke a whole other retry wrapper in sdk, unsure how I feel about that yet.

@tulir tulir changed the title Rework network request retries client: Rework network request retries Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants