Skip to content

Commit 4d06d62

Browse files
committed
refactor!: drop unused sessionRotationCount from Request
The crawler no longer increments this counter now that session errors are counted toward `retryCount`.
1 parent b67cf0b commit 4d06d62

1 file changed

Lines changed: 0 additions & 18 deletions

File tree

packages/core/src/request.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const requestOptionalPredicates = {
2323
payload: ow.optional.any(ow.string, ow.uint8Array),
2424
noRetry: ow.optional.boolean,
2525
retryCount: ow.optional.number,
26-
sessionRotationCount: ow.optional.number,
2726
sessionId: ow.optional.string,
2827
maxRetries: ow.optional.number,
2928
errorMessages: ow.optional.array.ofType(ow.string),
@@ -170,7 +169,6 @@ class CrawleeRequest<UserData extends Dictionary = Dictionary> {
170169
payload,
171170
noRetry = false,
172171
retryCount = 0,
173-
sessionRotationCount = 0,
174172
sessionId,
175173
maxRetries,
176174
errorMessages = [],
@@ -186,7 +184,6 @@ class CrawleeRequest<UserData extends Dictionary = Dictionary> {
186184
} = options as RequestOptions & {
187185
loadedUrl?: string;
188186
retryCount?: number;
189-
sessionRotationCount?: number;
190187
sessionId?: string;
191188
errorMessages?: string[];
192189
handledAt?: string | Date;
@@ -208,7 +205,6 @@ class CrawleeRequest<UserData extends Dictionary = Dictionary> {
208205
this.payload = payload;
209206
this.noRetry = noRetry;
210207
this.retryCount = retryCount;
211-
this.sessionRotationCount = sessionRotationCount;
212208
this.errorMessages = [...errorMessages];
213209
this.headers = { ...headers };
214210
this.handledAt = (handledAt as unknown) instanceof Date ? (handledAt as Date).toISOString() : handledAt!;
@@ -322,20 +318,6 @@ class CrawleeRequest<UserData extends Dictionary = Dictionary> {
322318
this.userData.__crawlee.crawlDepth = value;
323319
}
324320

325-
/** Indicates the number of times the crawling of the request has rotated the session due to a session or a proxy error. */
326-
get sessionRotationCount(): number {
327-
return this.userData.__crawlee?.sessionRotationCount ?? 0;
328-
}
329-
330-
/** Indicates the number of times the crawling of the request has rotated the session due to a session or a proxy error. */
331-
set sessionRotationCount(value: number) {
332-
if (!this.userData.__crawlee) {
333-
(this.userData as Dictionary).__crawlee = { sessionRotationCount: value };
334-
} else {
335-
this.userData.__crawlee.sessionRotationCount = value;
336-
}
337-
}
338-
339321
/** ID of a session to use for this request. When set, the crawler will fetch this session from the session pool instead of creating a new one. */
340322
get sessionId(): string | undefined {
341323
return this.userData.__crawlee?.sessionId;

0 commit comments

Comments
 (0)