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
constMyOctokit=Octokit.plugin(retry);constoctokit=newMyOctokit({auth: "secret123"});// retries request up to 3 times in case of a 500 responseoctokit.request("/").catch((error)=>{if(error.request.request.retryCount){console.log(`request failed after ${error.request.request.retryCount} retries`,);}console.error(error);});
To override the default doNotRetry list:
constoctokit=newMyOctokit({auth: "secret123",retry: {doNotRetry: [/* List of HTTP 4xx/5xx status codes */],},});
You can manually ask for retries for any request by passing { request: { retries: numRetries, retryAfter: delayInSeconds }}. Note that the doNotRetry option from the constructor is ignored in this case, requests will be retried no matter their response code.
octokit.request("/",{request: {retries: 1,retryAfter: 1}}).catch((error)=>{if(error.request.request.retryCount){console.log(`request failed after ${error.request.request.retryCount} retries`,);}console.error(error);});
Pass { retry: { enabled: false } } to disable this plugin.