brownfield-team / anacapa-github-linker

A tool for managing students in computer science courses. Deployed at:
https://ucsb-cs-github-linker.herokuapp.com
MIT License
4 stars 6 forks source link

pc - add 2 second delay to creating assignment repos #470

Closed pconrad closed 2 years ago

pconrad commented 3 years ago

The job to create assignment repos was flaky--many repos were not created.

Root cause was determined to be these errors:

2021-11-03T20:18:00.848898+00:00 app[web.1]: CREATION ERROR for lab05-rmarangoly for user rmarangoly {:data=>{:createRepository=>nil}, :errors=>[{:type=>"RATE_LIMITED", :path=>["createRepository"], :locations=>[{:line=>2, :column=>11}], :message=>"You have created too many repositories, too quickly. Please try again later."}]}

Attempt to fix by adding a delay (plus a Rails.logger.info so we can better track down assignment creation attempts and find the associated logging if/when debugging future problems.)

delay is configurable via environment variable SLEEP_DELAY

value is sleep time in seconds (converted to integer, and passed directly to ruby sleep )