sinedied / devto-cli

Dev.to authoring CLI to create and publish markdown files as articles, using assets hosted on GitHub.
MIT License
32 stars 3 forks source link

Update failed: HTTPError: Response code 429 (Too Many Requests) #33

Closed bcouetil closed 1 month ago

bcouetil commented 1 year ago

Hello, many thanks for this wonderful tool 🥰

I have this error when I push multiple (at least 5) articles at once :

Update failed: HTTPError: Response code 429 (Too Many Requests)

So when I update a minor thing in every articles, I fall back to this :

for file in *.md; do sleep 2 && dev push $file; done

Would it be possible to limit requests to dev.to ?

jikuja commented 10 months ago

Did you try dev push *.md instead of calling dev push multiple times?

bcouetil commented 10 months ago

Thank you for your time 😊

When I say "at once", I mean what you suggested. The loop is a workaround.

jikuja commented 10 months ago

Looks like I cannot read and/or understand.

I could not reproduce it with three updates. As soon as I have more articles to update I'll return to this unless it has been already fixed before that. Looks like three updates was not high enough to trigger throttling.

The code already has support for throttling:

https://github.com/sinedied/devto-cli/blob/main/src/api.ts#L11-L14 & https://github.com/sinedied/devto-cli/blob/main/src/api.ts#L76C55-L76C55 but it is turned on only for new article creation. It should be fairly easy to add similar throttling for updates but sane values are needed for that.

bcouetil commented 10 months ago

Great, thank you for the analysis, it makes sense : I have mostly existing articles, 10 of them in the same folder 👍

My workaround is satisfying for now.

sinedied commented 1 month ago

Fixed by #36

bcouetil commented 1 month ago

You rock man, thanks 🫡