skardhamar / rga

R Google Analytics
187 stars 90 forks source link

Graceful error recovery #58

Open kingo55 opened 9 years ago

kingo55 commented 9 years ago

Currently the errors are reported but not handled well, resulting in large queries having to be re-run when you occasionally hit certain rate limits (rare but annoying).

How might we implement exponential back off for error responses like?:

https://developers.google.com/analytics/devguides/reporting/core/v3/coreErrors#backoff

jdeboer commented 9 years ago

Have a look at the code I've written for the ganalytics package here https://github.com/jdeboer/ganalytics/blob/master/R/GaApiRequest.R#L108 , where I have attempted to implement exponential back off as explained above. I haven't tested that this is actually working though! So any feedback would be welcome. It should be relatively easy to take that code an apply to the rga package too.