mpawlowski / r2modman-headless

r2modman profile extractor for dedicated servers.
MIT License
5 stars 0 forks source link

thunderstore profile metadata: context deadline exceeded #3

Closed onyxraven closed 3 months ago

onyxraven commented 3 months ago

I am just starting to try out your code here to manage a dedicated valheim (lgsm) server's mods.

I ran up against an error immediately:

[Fx] RUNNING
2024/05/29 13:07:31 unable to pull thunderstore api: context deadline exceeded (Client.Timeout or context cancellation while reading body)
2024/05/29 13:07:31 Error processing mods: context deadline exceeded (Client.Timeout or context cancellation while reading body)

This is happening in r2modman.GetPackagesMetadata where the Get is timing out, though you've set the Timeout on the http.Client.

If I use http.Get instead of the specific Client, this disables the Timeout, of course, but it does succeed. The json from that endpoint (for valheim) is pretty slow and huge, so perhaps a longer timeout? I tried changing it to 60*time.Second but that didn't seem to do it, so I am trying to figure out whats happening there.

Otherwise, so far this looks super useful and I'm happy to help out a bit.

mpawlowski commented 3 months ago

I think this is the culprit. The timeout for the HTTP client used for that API is hard-coded to 10 seconds. I'll make this configurable.

mpawlowski commented 3 months ago

https://github.com/mpawlowski/r2modman-headless/commit/115c445f131c4199f3de9f3532b2ea554402c6ac should let you increase the timeout when fetching metadata using the thunderstore-metadata-timeout flag.

onyxraven commented 3 months ago

Nice! it looks like that helped! Thanks