You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I know the answer to my question, but just in case I'm wrong, I'm asking here. I have a TUI that wraps an http.Client. The TUI allows the user to select a slice of documents and then downloads each of the selected documents. The Update currently appends GET requests to a []tea.Cmd and then uses tea.Batch for the requests.
My problem is the third-party server holding the docs is flaky and seems to get overwhelmed. Downloading a document or a few is fine. Downloading several to dozens fails after successfully downloading a few files. I'm figuring the answer is to create a single tea.Cmd that takes a slice of requests, implements a rate limiter or worker pool to limit the number of concurrent requests, and returns a message with a slice of responses, but this seems unwieldy. (Or I could wrap the http.Client and add rate limits or a worker pool for batch requests.)
Using Bubble Tea, is there a way to use tea.Sequence or tea.Tick to accomplish something similar? Thanks a bunch.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello all.
I think I know the answer to my question, but just in case I'm wrong, I'm asking here. I have a TUI that wraps an
http.Client
. The TUI allows the user to select a slice of documents and then downloads each of the selected documents. TheUpdate
currently appends GET requests to a[]tea.Cmd
and then usestea.Batch
for the requests.My problem is the third-party server holding the docs is flaky and seems to get overwhelmed. Downloading a document or a few is fine. Downloading several to dozens fails after successfully downloading a few files. I'm figuring the answer is to create a single
tea.Cmd
that takes a slice of requests, implements a rate limiter or worker pool to limit the number of concurrent requests, and returns a message with a slice of responses, but this seems unwieldy. (Or I could wrap thehttp.Client
and add rate limits or a worker pool for batch requests.)Using Bubble Tea, is there a way to use
tea.Sequence
ortea.Tick
to accomplish something similar? Thanks a bunch.Beta Was this translation helpful? Give feedback.
All reactions