-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Performance: Improve speed of automatic instance redirection #4193
Performance: Improve speed of automatic instance redirection #4193
Conversation
5325e52
to
ac38c25
Compare
@@ -40,7 +40,16 @@ module Invidious::Routes::Misc | |||
|
|||
def self.cross_instance_redirect(env) | |||
referer = get_referer(env) | |||
instance_url = fetch_random_instance | |||
|
|||
instance_list = Invidious::Jobs::InstanceListRefreshJob::INSTANCES["INSTANCES"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should be used to add some sites for reddit comments eventually as well
invidious/src/invidious/comments/reddit.cr
Lines 8 to 9 in 9e8baa3
# TODO: Use something like #479 for a static list of instances to use here | |
query = URI::Params.encode({q: "(url:3D#{id} OR url:#{id}) AND (site:invidio.us OR site:youtube.com OR site:youtu.be)"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me, this can be used for the eventual Lemmy source as well.
Though does Reddit's search functionality even support filtering for that many sites at once?
This comment has been minimized.
This comment has been minimized.
The HTTP::Client created via `make_client` is affected by the force_resolve configuration option. However, api.invidious.io does not support ipv6 and as such any request with ipv6 to api.invidious.io will instead raise. Directly calling the HTTP::Client will ignore the force_resolve option allowing requests to go through ipv4 when needed.
a84100f
to
9980c0e
Compare
This pull request has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely abandoned or outdated. If you think this pull request is still relevant and applicable, you just have to post a comment and it will be unmarked. |
Thanks for your contribution :) |
The automatic instance redirection implemented in #1940 fetches a new list of instances each time someone queries the
/redirect
endpoint. This is extremely inefficient...This PR optimizes all that into a background job that only fetches a single list every 30 minutes. This should performance quite a bit.