fix: add GitHub raw fallback & reduced timeout for Pastebin manifest - #549
fix: add GitHub raw fallback & reduced timeout for Pastebin manifest#549nandhanay wants to merge 1 commit into
Conversation
|
Thanks for addressing this so quickly. I reviewed the PR against the current One remaining startup-path concernThere is one detail in the cleanup path that may still cause an unnecessary Pastebin connection attempt for users in regions where Pastebin is blocked.
streamRepository.removeCustomAddonsByUrl(
CollectionTemplateManifest.autoInstalledAddonUrls() +
listOf(
MediaRepository.STREAMING_COLLECTION_ADDON_URL,
MediaRepository.PASTEBIN_STREAMING_ADDON_URL
)
)However, val normalizedUrls = urls
.mapNotNull { url ->
runCatching { resolveAddonInstallUrl(url) }
.getOrNull()
?.takeIf { it.isNotBlank() }
}
.distinct()
.toSet()And That means the normal startup flow can become:
So the PR should reduce the original ~14-second stall substantially, but the explicit Pastebin cleanup entry may still leave an avoidable ~3.5-second delay on the normal successful GitHub path. Suggested minimal changeUnless the explicit Pastebin pointer is required for a separate migration case, I think the cleanup path only needs the primary pointer: streamRepository.removeCustomAddonsByUrl(
CollectionTemplateManifest.autoInstalledAddonUrls() +
listOf(MediaRepository.STREAMING_COLLECTION_ADDON_URL)
)This keeps the behavior surgical:
The fallback itself remains fully available inside Why this should still clean up the installed addon
val normalizedUrl = resolveAddonInstallUrl(url)
...
val newAddon = Addon(
...
url = normalizedUrl,
...
)So when the remote pointer resolves successfully, the installed addon is identified by the resolved addon URL, not by the Pastebin/GitHub pointer that was used to obtain it. Resolving the primary pointer once during cleanup should therefore produce the URL needed for matching. Test coverage suggestionThe new The first case is especially important for this issue because it guarantees that a blocked Pastebin endpoint stays completely off the normal startup path. I would keep the fix focused on this request-order behavior rather than add extra caching at this stage; the repository-hosted pointer already provides a clean source of truth, and caching a resolved manifest URL could introduce stale-URL behavior unless expiry/invalidation is defined. Overall, the PR is a good solution to the original issue. This is just a small follow-up that may remove the remaining blocked-domain wait entirely while preserving the fallback design. Thanks again for the quick response and implementation. |
Summary
Fixes #537
Hardcoded Pastebin dependency (
https://pastebin.com/raw/P4gfd98n) caused a ~14-second TCP connection timeout on startup for users in Turkey and regions where Pastebin is blocked.Changes
config/streaming_addon.txt.STREAMING_COLLECTION_ADDON_URLto GitHub raw URL and retainedPASTEBIN_STREAMING_ADDON_URLas secondary fallback.resolveAddonInstallUrlto use a 3.5s fast timeout and automatic fallback chain between GitHub raw and Pastebin.StreamAddonFallbackTest.