You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to retry a request N times with M seconds between each request, based on the response json data. The page returns a 200 status, so the retry isn't being triggered by default. Here is what I have so far:
asyncfunctionwaitTillComplete(name){letretries=0;while(retries<5){retries+=1;// note - this won't retry on request failures or error codes, change opts accordinglyconstresponse=awaitgot(`https://api.gfycat.com/v1/gfycats/fetch/status/${name}`);// could use "json" option of got insted to auto-json parseconst{task}=JSON.parse(response.body);if(task=='complete'){returnresponse;}}thrownewError(`Max retries reached for ${name}`);}
I'd like to retry a request N times with M seconds between each request, based on the response json data. The page returns a 200 status, so the retry isn't being triggered by default. Here is what I have so far:
I'm not sure how to force a retry with a 200 status, and any help would be appreciated.
The text was updated successfully, but these errors were encountered: