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 Image Proxy 'TCP Timeout' Error #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ryouko-dev
Copy link

This will fix issue #106. The changes are as follows:

Inside of config/config.go:

Disable IPV6 due to it not working correctly with most image-based search engines.
Change RequestTimeout to something higher to prevent timeouts. Does not change responsiveness of image searches.
Enable FollowRedirect. There were some rare cases where having it disabled caused issues with loading images.

Inside of morty.go:

Add MaxConnsPerHost: 4. This will limit connections per host to 4. Images still load quickly.
Change time.Second to time.Minute. This adds far more time for an image to load and causes less timeouts.

This should fix most issues with timeouts from image-based search engines. Through my testing so far, I have found that at most one image will timeout from a search even after loading 5+ pages of images. This could be higher in some cases as I haven't tested more than a few days but should generally be small enough to not bother the user.

Unsure if this is required or not but I have changed the following settings in /etc/searx/settings.yml as well just to make sure that the hosts configuration is the same. Unsure if this changes anything so please do let me know.

outgoing:
    pool_connections : 100 
    pool_maxsize : 4

Changes should work without any other configuration.

@@ -1100,7 +1101,7 @@ func main() {
log.Println("Using IPv4 only direct connections.")
}

p := &Proxy{RequestTimeout: time.Duration(cfg.RequestTimeout) * time.Second,
p := &Proxy{RequestTimeout: time.Duration(cfg.RequestTimeout) * time.Minute,
Copy link
Owner

Choose a reason for hiding this comment

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

Do I understand correctly, that the timeout is increased to 600 minutes? It doesn't sound a good default for production usage.

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.

2 participants