jmichaelward / board-game-collector

A WordPress plugin to retrieve user game collections using the BoardGameGeek API.
https://jmichaelward.com
6 stars 1 forks source link

Sleep and retry API request if BoardGameGeek returns a 202. #28

Closed jmichaelward closed 4 years ago

jmichaelward commented 4 years ago

When querying the BoardGameGeek API for a user's collection for the first time (or the first time in awhile), BGG goes and prepares the collection and returns a 202 response alerting the client to try again later.

Let's update our processing so that WordPress will try again after a few seconds have passed.

jmichaelward commented 4 years ago

This has been implemented, with a sleep of 10 seconds before attempting a re-request. This should be long enough for most first-time requests; especially large collections may take a few iterations. WP-CLI will output a notice indicating that the request was received and that it will be retried.