Add configurable mediaTimeout option for media upload polling#1341
Conversation
size-limit report 📦
|
commit: |
Co-authored-by: neet <19276905+neet@users.noreply.github.com>
|
@copilot mediaTimeout in HttpConfig is assigned but never used in the implementation class. It'd be more clean and solid if we have an object type that is only referred in the factory functions (just like LogConfigProps). Oauth and Streaming API will never use the polling so it's enough if we have it in REST as an intersection type. |
Co-authored-by: neet <19276905+neet@users.noreply.github.com>
Refactored to use |
|
@copilot so much better now. Please also put |
Co-authored-by: neet <19276905+neet@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds a configurable mediaTimeout option to allow users to customize the polling timeout when uploading media. Previously, this timeout was hardcoded at 60 seconds, which could cause issues for users with slower connections or larger files.
Key changes:
- Created
MediaConfigPropsinterface to define themediaTimeoutconfiguration option - Made
mediaTimeoutavailable only increateRestAPIClientfactory function (OAuth and Streaming APIs don't use media uploads) - Marked the option as
@experimentalto indicate potential future changes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/adapters/clients.ts | Added MediaConfigProps interface with mediaTimeout property and passed it to HttpActionDispatcherHookMastodon |
| src/adapters/action/dispatcher-http-hook-mastodon.spec.ts | Added test case to verify custom mediaTimeout value is respected |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add configuration option for
mediaTimeoutto allow users to customize the media upload polling timeout.Changes:
MediaConfigPropsinterface following the pattern ofLogConfigPropsMediaConfigPropsonly tocreateRestAPIClient(REST API uses media uploads)mediaTimeoutfromMastoHttpConfigProps(not used by HttpConfigImpl)mediaTimeout(doesn't use media uploads)@experimentalTSDoc tag to indicate behavior may change without announcementSummary:
Users can now configure the
mediaTimeoutoption when creating REST API clients. The implementation follows the existing pattern used byLogConfigProps- the property is defined in a separate interface that's only used in factory functions, not in the config implementation classes.The
mediaTimeoutparameter is only available forcreateRestAPIClientsince OAuth and Streaming APIs don't use media uploads. The parameter is marked as@experimentalto indicate that its behavior may change without any announcement.Original prompt
mediaTimeout#1340💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.