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

Queue System #59

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Queue System #59

wants to merge 6 commits into from

Conversation

musabgultekin
Copy link
Collaborator

No description provided.

musabgultekin and others added 6 commits October 22, 2021 22:07
- Moves middleware logic to prior to goroutine (which blocks on rate limiter) allowing quick cancellation and avoids queues containing requests that will be cancelled.
- Extracts the delay middleware to execute separately within the goroutine
- Handles full queues by discarding URLs and logging a message
Queue performance enhancements + delay middleware fix
@musabgultekin
Copy link
Collaborator Author

@glaslos Its a bit old code but what do you think?

@@ -349,3 +392,29 @@ func (g *Geziyor) startExporters() {
}()
}
}

func (g *Geziyor) startWorkers() {
if g.Opt.ConcurrentRequests != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

If ConcurrentRequests would be 1 by default, you could removed the entire alternative logic section

func (g *Geziyor) startWorkers() {
if g.Opt.ConcurrentRequests != 0 {
for i := 0; i < g.Opt.ConcurrentRequests; i++ {
go func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd use a waitgroup for each go function so you can wait for them all to complete.

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.

None yet

3 participants