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(crawler): separate timeout per query #999

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

lidel
Copy link
Member

@lidel lidel commented Nov 15, 2024

This PR aims to correctly apply the fix from:

Problem

It did not work as expected because context.WithTimeout was created once per goroutine but was used for multiple queries within the for p := range jobs loop.

This meant once the timeout expires for the first query, all subsequent queries in that worker would immediately fail since they're using the same expired context. The crawl ended in ~15s instead of few minutes.

Fix is to have new context per job.

This aims to correctly apply intention of fix from
#996

It did not work correctly because `context.WithTimeout`  was created once
per goroutine but was used for multiple queries within
the `for p := range jobs` loop.

This meant once the timeout expires for the first query, all subsequent
queries in that worker would immediately fail since they're using the
same expired context.
@lidel lidel requested review from guillaumemichel and a team as code owners November 15, 2024 01:36
@lidel lidel removed the request for review from sukunrt November 15, 2024 02:31
@guillaumemichel guillaumemichel merged commit ace7582 into master Nov 15, 2024
9 checks passed
@guillaumemichel guillaumemichel deleted the fix/context-from-996 branch November 15, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants