AtProtoClient's clock never reaches its XRPC transport #187
Labels
No labels
breaking-change
bug
documentation
duplicate
enhancement
good first issue
help wanted
performance
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Grandiras/ATProto.NET#187
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
AtProtoClient's internal constructor (AtProtoClient(options, httpClient, sessionStore, logger, TimeProvider timeProvider), used by tests) builds itsXrpcClientwithout settingXrpcClient.TimeProvider. The clock only reachesSessionManager.XrpcClient.TimeProviderdrives the 429 retryTask.Delay, theRetry-After/RateLimit-Resetarithmetic, and the timestamps on the exceptions it creates. Production is unaffected, since the public constructor always passesTimeProvider.System. But tests have to work around it:VideoUploadTests.UploadVideoAsync_BacksOffExponentiallybuilds its ownXrpcClient+VideoClientto get its clock into the transport.Steps to Reproduce
AtProtoClientthrough the internal constructor with a fakeTimeProviderthat records the timers it is asked for.Retry-After), then 200.Expected Behavior
The retry back-off (1 s, with jitter) goes through the injected clock.
Actual Behavior
The fake clock sees no delay; the retry waits on the system clock.
ATProtoNet Version
main(0.7.0 cycle).NET Version
10.0
Fix
Pass
timeProviderto theXrpcClientinitializer alongsideUserAgentandRateLimit, add a regression test that observes the retry back-off through a client-level clock, and drop the video test's workaround.