retry fetch failed error
is there a simple flag to have ConvexHttpClient retry what seems to be a connection timeout error?
It seems some mutations were dropped when this error occurred.
This came up while I was performance testing, I haven't seen in production.
4 Replies
Out of curiosity, could this use case be using the ConvexClient instead? That one has a websocket and manages connections, serialization, etc more robustly. The http client just makes a fetch per call, so each mutation can succeed / fail independently or even arrive out of order if the network struggles
For http I’d suggest adding your own retries around queries, but only on mutations you can guarantee idempotence on
Due to http limitations, it could succeed in mutating but seem to fail on the client
we're running this from a nestjs backend. I think we went with ConvexHttpClient for that reason, would you recommend the ConvexClient also for a nestjs backend?
@ian just bumping the above^
Yeah I think http is the right fit for SSR. Hopefully the network blips are very transient. For queries it’s totally fine to wrap it in a retry on network errors if it’s happening too often. During performance testing maybe the network was clogged is my only thought otherwise
Ah I thought you had mistyped 🙈
If it’s a long-lived thing then the websocket client is the best bet
But note that you set auth on it per-client, so it still might still want to be per-user-request. Establishing a websocket for a few messages might be overkill? Maybe give it a shot and see how it works for you
This one is actually not per user and can be long-lived.
Good to know your thoughts, for science; we're killing that backend completely to shift to convex (🙌) so won't be using either client pretty soon