Skip to content

Commit 6fe6898

Browse files
vdusekclaude
andcommitted
fix: Correct inverted return value in Scrapy scheduler enqueue_request
The enqueue_request method was returning bool(result.was_already_present), which incorrectly returned True for duplicates and False for newly enqueued requests. Per Scrapy's BaseScheduler contract, it should return True when the request was successfully stored (new) and False when rejected (duplicate). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 252eb4e commit 6fe6898

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/apify/scrapy/scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def enqueue_request(self, request: Request) -> bool:
136136
raise
137137

138138
logger.debug(f'rq.add_request result: {result}')
139-
return bool(result.was_already_present)
139+
return not bool(result.was_already_present)
140140

141141
def next_request(self) -> Request | None:
142142
"""Fetch the next request from the scheduler.

0 commit comments

Comments
 (0)