Skip to content

Commit

Permalink
rename retryTimeout to retryInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
Miniast committed May 8, 2024
1 parent e2682f8 commit 0cf8d3d
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Crawler extends EventEmitter {
jQuery: true,
priority: 5,
retries: 3,
retryTimeout: 2000,
retryInterval: 2000,
timeout: 15000,
isJson: true,
};
Expand Down Expand Up @@ -172,7 +172,7 @@ class Crawler extends EventEmitter {
options.retries!--;
this._execute(options as crawlerOptions);
options.release!();
}, options.retryTimeout);
}, options.retryInterval);
return;
}
else {
Expand Down
3 changes: 1 addition & 2 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const alignOptions = (options: any): any => {
"forceUTF8",
"incomingEncoding",
"jQuery",
"retryTimeout",
"retryInterval",
"priority",
"proxy",
"retries",
Expand Down Expand Up @@ -65,7 +65,6 @@ export const alignOptions = (options: any): any => {
searchParams: options.qs,
rejectUnauthorized: options.strictSSL,
decompress: options.gzip,
cookieJar: options.jar,
parseJson: options.jsonReviver,
stringifyJson: options.jsonReplacer,
timeout: { request: options.timeout },
Expand Down
3 changes: 2 additions & 1 deletion src/types/crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type requestOptions = {
*/
rateLimiterId?: number;
retries?: number;
retryTimeout?: number;
retryInterval?: number;
timeout?: number;
priority?: number;
seenreq?: any;
Expand Down Expand Up @@ -116,6 +116,7 @@ type requestOptions = {

/**
* @deprecated Please use "cookieJar" instead.
* @see tough-cookie https://github.com/sindresorhus/got/blob/main/documentation/migration-guides/request.md
*/
jar?: Object;
cookieJar?: Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/cacheOption.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Cache features tests', function () {
jQuery: false,
skipDuplicates: true,
retries: 1,
retryTimeout: 10,
retryInterval: 10,
callback: function (error) {
expect(error).to.exist;
expect(koScope.isDone()).to.be.true;
Expand Down
2 changes: 1 addition & 1 deletion tests/callback.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Callback test', function() {

beforeEach(() => {
crawler = new Crawler({
retryTimeout:0,
retryInterval:0,
retries:0,
timeout:100,
logger: {
Expand Down
2 changes: 1 addition & 1 deletion tests/errorHandling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Errors', function() {
describe('timeout', function() {
const crawler = new Crawler({
timeout: 500,
retryTimeout: 500,
retryInterval: 500,
retries: 2,
jQuery: false
});
Expand Down
4 changes: 2 additions & 2 deletions tests/ignore/http2errorHandling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Errors', function () {
describe('timeout', function () {
const crawler = new Crawler({
timeout: 2000,
retryTimeout: 1000,
retryInterval: 1000,
retries: 2,
jQuery: false,
http2: true
Expand Down Expand Up @@ -47,7 +47,7 @@ describe('Errors', function () {

describe('error status code', function () {
const crawler = new Crawler({
retryTimeout: 1000,
retryInterval: 1000,
retries: 2,
jQuery: false,
http2: true
Expand Down
6 changes: 3 additions & 3 deletions tests/ignore/http2response.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('request body', function () {

it('response statusCode', function (finishTest) {
c = new Crawler({
retryTimeout: 1000,
retryInterval: 1000,
retries: 2,
jQuery: false,
http2: true
Expand All @@ -31,7 +31,7 @@ describe('request body', function () {

it('response headers', function (finishTest) {
c = new Crawler({
retryTimeout: 1000,
retryInterval: 1000,
retries: 2,
jQuery: false,
http2: true
Expand All @@ -52,7 +52,7 @@ describe('request body', function () {

it('html response body', function (finishTest) {
c = new Crawler({
retryTimeout: 1000,
retryInterval: 1000,
retries: 2,
jQuery: true,
http2: true
Expand Down
4 changes: 2 additions & 2 deletions tests/memoryLeaks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// jQuery: true,
// timeout: 500,
// autoWindowClose: false,
// retryTimeout: 1000,
// retryInterval: 1000,
// retries: 1,
// onDrain: function() {
// // Wait a bit for the GC to kick in
Expand Down Expand Up @@ -56,7 +56,7 @@
// jQuery: false,
// timeout: 500,
// autoWindowClose: false,
// retryTimeout: 1000,
// retryInterval: 1000,
// retries: 1,
// onDrain: function() {
// // Wait a bit for the GC to kick in
Expand Down
4 changes: 2 additions & 2 deletions tests/preRequest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('preRequest feature tests', function() {
crawler = new Crawler({
jQuery: false,
rateLimit: 20,
retryTimeout: 0,
retryInterval: 0,
preRequest: (options, done) => {
cb('preRequest');
done(new Error());
Expand All @@ -119,7 +119,7 @@ describe('preRequest feature tests', function() {
// crawler = new Crawler({
// jQuery: false,
// rateLimit: 20,
// retryTimeout: 0,
// retryInterval: 0,
// preRequest: (options, done) => {
// cb('preRequest');
// const error = new Error();
Expand Down

0 comments on commit 0cf8d3d

Please sign in to comment.