Cap concurrent ssh connections a batch opens at once
Deleting or importing several Claude Code sessions fired one ssh process per item, all in the same tick. A large enough batch opened more connections than the remote sshd's default MaxStartups tolerates before it starts randomly refusing, so some rows failed with "Connection closed by ... port 2222" -- not a real delete failure, just too many handshakes landing at once. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7a8811aab3
commit
927b638feb
2 files changed
+26
No files matched your search
@@ -163,6 +163,13 @@ pub fn tidy(value: &str) -> Option<String> {
|
||||
/// Runs a launch to completion and returns its stdout.
|
||||
impl Transport {
|
||||
pub async fn capture(&self, launch: &Launch) -> Result<String> {
|
||||
// See `CAPTURE_PERMITS`: caps how many of these run their ssh
|
||||
// connection at once, so a batch doesn't open more than the remote
|
||||
// sshd tolerates before it starts dropping them.
|
||||
let _permit = super::session::transport::CAPTURE_PERMITS
|
||||
.acquire()
|
||||
.await
|
||||
.expect("capture semaphore is never closed");
|
||||
let child = self.spawn(launch, super::session::transport::Streams::Piped)?;
|
||||
let output = child
|
||||
.wait_with_output()
|
||||
|
||||
Reference in new issue
Block a user