jupyterhub / binderhub

Run your code in the cloud, with technology so advanced, it feels like magic!
https://binderhub.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.54k stars 388 forks source link

Limit stacking jupyterhub API requests #1680

Closed minrk closed 1 year ago

minrk commented 1 year ago

Without this, several API requests can be outstanding at the same time if things are getting slow

consideRatio commented 1 year ago

A cache is used otherwise? Makes sense

minrk commented 1 year ago

Yes, the other health checks are already cached in this way. The at_most_every decorator does two things:

  1. cache results for interval seconds, and
  2. (more directly relevant) ensure only one check is outstanding at a time, returning the outstanding Future if there is already an outstanding call

I'm going to rewrite the health handlers to poll in the background instead of on request, so the health handler should always be responsive.