Remove CancellationToken from semaphore WaitAsync calls

Removed the `CancellationToken` parameter from `WaitAsync` calls
on semaphores in `EverythingAPI.cs` and `Main.cs`. This change
eliminates cancellation support for semaphore waits, likely due
to a design decision prioritizing simplicity or avoiding issues
with cancellation handling.

In `EverythingAPI.cs`, `WaitAsync(token)` was replaced with
`WaitAsync()` in two methods. Similarly, in `Main.cs`, the
`WaitAsync` calls for `_win32sLock` and `_uwpsLock` were updated
to remove the `token` parameter.

Note: This change may impact the ability to gracefully handle
cancellation during semaphore waits.
This commit is contained in:
Jack251970 2025-11-04 14:25:55 +08:00
parent 6e17d5d756
commit db0c86d50c
2 changed files with 5 additions and 6 deletions

View file

@ -48,7 +48,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
public static async ValueTask<bool> IsEverythingRunningAsync(CancellationToken token = default)
{
await _semaphore.WaitAsync(token);
await _semaphore.WaitAsync();
try
{
@ -77,8 +77,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
if (option.MaxCount < 0)
throw new ArgumentOutOfRangeException(nameof(option.MaxCount), option.MaxCount, "MaxCount must be greater than or equal to 0");
await _semaphore.WaitAsync(token);
await _semaphore.WaitAsync();
try
{

View file

@ -86,10 +86,10 @@ namespace Flow.Launcher.Plugin.Program
Context.API.LogDebug(ClassName, $"Cache miss for query: {query.Search}");
var resultList = await Task.Run(async () =>
{
Context.API.LogDebug(ClassName, "Acquiring locks for querying programs");
await _win32sLock.WaitAsync(token);
Context.API.LogDebug(ClassName, "Acquiring locks for querying win32 programs");
await _uwpsLock.WaitAsync(token);
await _win32sLock.WaitAsync();
Context.API.LogDebug(ClassName, "Acquiring locks for querying uwp programs");
await _uwpsLock.WaitAsync();
Context.API.LogDebug(ClassName, "Locks acquired for querying programs");
try
{