Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 429 Too Many Requests #6

Open
peteolbrys opened this issue Apr 5, 2021 · 2 comments
Open

Error: 429 Too Many Requests #6

peteolbrys opened this issue Apr 5, 2021 · 2 comments

Comments

@peteolbrys
Copy link

peteolbrys commented Apr 5, 2021

Started getting 429 errors this morning while running the bot locally in a Docker container, after pulling down latest main:

vaccine-bot_1  | E, [2021-04-05T08:43:45.596599 #1] ERROR -- : [Southcoast] Failed to get appointments: 429 Too Many Requests
vaccine-bot_1  | E, [2021-04-05T08:43:45.596883 #1] ERROR -- : [Main] Error: 429 Too Many Requests
vaccine-bot_1  | /usr/local/bundle/gems/rest-client-2.1.0/lib/restclient/abstract_response.rb:249:in `exception_with_response': 429 Too Many Requests (RestClient::TooManyRequests)
vaccine-bot_1  | 	from /usr/local/bundle/gems/rest-client-2.1.0/lib/restclient/abstract_response.rb:129:in `return!'
vaccine-bot_1  | 	from /usr/local/bundle/gems/rest-client-2.1.0/lib/restclient/request.rb:836:in `process_result'
vaccine-bot_1  | 	from /usr/local/bundle/gems/rest-client-2.1.0/lib/restclient/request.rb:743:in `block in transmit'
vaccine-bot_1  | 	from /usr/local/lib/ruby/3.0.0/net/http.rb:960:in `start'
vaccine-bot_1  | 	from /usr/local/bundle/gems/rest-client-2.1.0/lib/restclient/request.rb:727:in `transmit'
vaccine-bot_1  | 	from /usr/local/bundle/gems/rest-client-2.1.0/lib/restclient/request.rb:163:in `execute'
vaccine-bot_1  | 	from /usr/local/bundle/gems/rest-client-2.1.0/lib/restclient/request.rb:63:in `execute'
vaccine-bot_1  | 	from /usr/local/bundle/gems/rest-client-2.1.0/lib/restclient.rb:70:in `post'
vaccine-bot_1  | 	from /usr/src/app/lib/sites/southcoast.rb:67:in `json_data'
vaccine-bot_1  | 	from /usr/src/app/lib/sites/southcoast.rb:44:in `clinics'
vaccine-bot_1  | 	from /usr/src/app/lib/sites/southcoast.rb:31:in `block (2 levels) in all_clinics'
vaccine-bot_1  | 	from /usr/src/app/lib/sentry_helper.rb:5:in `catch_errors'
vaccine-bot_1  | 	from /usr/src/app/lib/sites/southcoast.rb:29:in `block in all_clinics'
vaccine-bot_1  | 	from /usr/src/app/lib/sites/southcoast.rb:27:in `each'
vaccine-bot_1  | 	from /usr/src/app/lib/sites/southcoast.rb:27:in `flat_map'
vaccine-bot_1  | 	from /usr/src/app/lib/sites/southcoast.rb:27:in `all_clinics'
vaccine-bot_1  | 	from run.rb:47:in `block in all_clinics'
vaccine-bot_1  | 	from run.rb:46:in `each'
vaccine-bot_1  | 	from run.rb:46:in `all_clinics'
vaccine-bot_1  | 	from run.rb:97:in `block (2 levels) in main'
vaccine-bot_1  | 	from run.rb:61:in `sleep_for'
vaccine-bot_1  | 	from run.rb:95:in `block in main'
vaccine-bot_1  | 	from run.rb:94:in `loop'
vaccine-bot_1  | 	from run.rb:94:in `main'
vaccine-bot_1  | 	from run.rb:122:in `<main>'

Running on MacOS 11.1, Docker Desktop 3.2.2 (61853)

@sgarfinkel
Copy link

Looks like Southcoast is throttling. Probably need to reduce the frequency of checks against them. Is this a persistent issue for you or were you maybe restarting the container a bunch of times?

@dpca
Copy link
Member

dpca commented Apr 5, 2021

If you run the container with the environment variable ENVIRONMENT=production it will bypass these errors without crashing (it will still log them though). Check out lib/sentry_helper.rb for how this works, but it essentially lets each scraper be isolated from crashing the others. I'll put some additional info in the readme so this behavior is more clear.

I've seen Southcoast return 429s occasionally in the middle of the night, but it seems to go away after a few minutes so I haven't put much effort into changing things there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants