0

I want to setup retry policy for Drive Rest API client but I can't find a way how to do it. I found only this article but it says nothing about implementations. Does it mean I should implement retry logic myself or I missed something?

pinoyyid
  • 21,499
  • 14
  • 64
  • 115
4ybaka
  • 2,954
  • 4
  • 16
  • 21

1 Answers1

0

You'll need to code your own retry policy. Here are some tips:-

  • 401 - this is an expired access token, so get a fresh token and retry
  • 403 - check the message to see if this is a "rate limit exceeded". If so, you need to retry with a throttle. A delay of 1.5-2 seconds will normally be acceptable.
  • 5xx - these are sometimes transient errors in Gdrive and sometimes a bug. Do an exponential backoff and retry, but don't bother retrying more than 3 or 4 times, because if it hasn't worked yet, it's unlikely to.
pinoyyid
  • 21,499
  • 14
  • 64
  • 115
  • You could try to use the .NET library Polly to implement retry logic. More information: https://stackoverflow.com/questions/1563191/cleanest-way-to-write-retry-logic?#16382831 – GJBisschop Oct 28 '19 at 16:16