mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-02 12:59:45 +00:00
Avoid panicking when the resolver thread encounters a closed channel (#6182)
Closes https://github.com/astral-sh/uv/issues/6167 We've been seeing intermittent failures in CI, which we thought were unexpected HTTP 401s but it actually looks like a panic when handling an expected HTTP error. I believe the problem is that an early client error can cause the channel to close and we crash when we unwrap the `send`.
This commit is contained in:
parent
615dda0e94
commit
baf17bee86
1 changed files with 4 additions and 1 deletions
|
|
@ -271,7 +271,9 @@ impl<Provider: ResolverProvider, InstalledPackages: InstalledPackagesProvider>
|
|||
.name("uv-resolver".into())
|
||||
.spawn(move || {
|
||||
let result = solver.solve(index_locations, request_sink);
|
||||
tx.send(result).unwrap();
|
||||
|
||||
// This may fail if the main thread returned early due to an error.
|
||||
let _ = tx.send(result);
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
|
|
@ -279,6 +281,7 @@ impl<Provider: ResolverProvider, InstalledPackages: InstalledPackagesProvider>
|
|||
|
||||
// Wait for both to complete.
|
||||
let ((), resolution) = tokio::try_join!(requests_fut, resolve_fut)?;
|
||||
|
||||
state.on_complete();
|
||||
resolution
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue