Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correctly compute pendingRequestCount in request queue #1765

Merged
merged 1 commit into from
Feb 6, 2023

Conversation

jirimoravcik
Copy link
Member

Logic in https://github.com/apify/crawlee/blob/master/packages/memory-storage/src/resource-clients/request-queue.ts#L291-L298 is wrong. You can even see that pendingRequestCount is being changed by handledCountAdjustment. There are a few more cases...

I fixed them and also simplified the code to be actually readable

@jirimoravcik jirimoravcik added the bug Something isn't working. label Jan 30, 2023
@jirimoravcik jirimoravcik requested a review from B4nan January 30, 2023 15:07
Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks! Can we add some test or at least new assertions for this, to ensure we won't break it again?

Maybe @vladfrangu can suggest where to test it easily.

@B4nan B4nan requested a review from vladfrangu January 30, 2023 15:18
Copy link
Member

@vladfrangu vladfrangu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely much more readable, thanks! We should probably apply this PR to storage-local sometime

@vladfrangu
Copy link
Member

Maybe @vladfrangu can suggest where to test it easily.

If I was doing this PR I'd create a test for the pending count (pending-count-correct-update.tet.ts?) in packages/memory-storage/test. Thankfully it doesn't need anything fancy

@B4nan
Copy link
Member

B4nan commented Feb 6, 2023

I'll merge it so we can ship it, but a PR with test would be nice :]

@B4nan B4nan merged commit 946535f into master Feb 6, 2023
@B4nan B4nan deleted the fix/rq-pending-request-count branch February 6, 2023 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants