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

feat(opt-in): kill previous searches when a new search is started #100

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

mikavilpas
Copy link
Owner

Issue

When typing text, if there are no matches for a ripgrep search, each
keypresses starts a new ripgrep search. This can lead to many searches
being active at the same time. This takes up resources and is not useful
(if the word did not match previously, it will never match with a longer
search string).

Solution

Stop previously running searches when a new search is started. This is
currently disabled by default (soft launch). To opt in, see the README.

If this works well for some time, it might become the default in the
future.

@mikavilpas mikavilpas changed the base branch from main to test-one-invocation January 9, 2025 16:14
@mikavilpas mikavilpas force-pushed the too-many-invocations branch from 498f198 to 963853c Compare January 9, 2025 16:16
@mikavilpas
Copy link
Owner Author

cc @Saghen, I was wondering if repeating searches with longer search strings is a useful feature in blink, or if it would make to also fix it there. It seems like if a short search produces no results, a longer search string might never produce additional results because it always requires a more accurate match.

But I might be wrong 🙂

@mikavilpas mikavilpas force-pushed the test-one-invocation branch from 8feb7b9 to 6d272ad Compare January 9, 2025 19:03
Base automatically changed from test-one-invocation to main January 9, 2025 19:04
Issue
=====

When typing text, if there are no matches for a ripgrep search, each
keypresses starts a new ripgrep search. This can lead to many searches
being active at the same time. This takes up resources and is not useful
(if the word did not match previously, it will never match with a longer
search string).

Solution
========

Stop previously running searches when a new search is started. This is
currently disabled by default (soft launch). To opt in, see the README.

If this works well for some time, it might become the default in the
future.
@mikavilpas mikavilpas force-pushed the too-many-invocations branch from 963853c to 2bd4d6a Compare January 9, 2025 19:05
@mikavilpas mikavilpas enabled auto-merge (squash) January 9, 2025 19:05
This should fix the ci test timeout issue and provide details on how it
can be fixed.
@mikavilpas mikavilpas merged commit 705069a into main Jan 9, 2025
11 checks passed
@mikavilpas mikavilpas deleted the too-many-invocations branch January 9, 2025 19:32
@Saghen
Copy link

Saghen commented Jan 9, 2025

@mikavilpas It should be waiting for the current request to finish before sending another in the same context. If the context changes while a request is in-flight, it should call the cancellation functions returned by get_completions before making a new request. It should also only make additional requests within the same context to get_completions if is_incomplete_forward/backward = true and we moved forward or backward in the context. If that's not the case, there's a bug on my end

@mikavilpas
Copy link
Owner Author

Ah I see, I think I need to hook into those instead. Thanks for the explanation 👍🏻

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