lakenen / node-box-view

A node client for the Box View API
MIT License
13 stars 2 forks source link

rate limiting helper? ლ(ಠ益ಠლ) #5

Closed seanrose closed 10 years ago

seanrose commented 10 years ago

Would it be good to have some kind of optional rate limiting helper built into createDefaultResponseHandler with similar to https://github.com/lakenen/node-box-view/blob/master/index.js#L338 (since rate limiting can occur on any method)?

lakenen commented 10 years ago

Yeah, I was going to refactor that stuff a bit. How do you think the rate-limiting stuff should be exposed externally? Maybe an options arg to all methods?

lakenen commented 10 years ago

Digging a bit deeper... right now, all 429 errors are just exposed as an error object, and rate-limiting must be handled manually. The 202 w/ retry-after used in session/thumbnail/content calls is not necessarily rate-limiting per se, but actually just the API saying "wait, I'm still processing". So I think it's fundamentally different in that sense.