mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
perf: ssh 增加超时断开连接,默认10分钟超时
This commit is contained in:
@@ -588,10 +588,15 @@ export class SshClient {
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
let timeoutId = null;
|
||||
try {
|
||||
timeoutId = setTimeout(() => {
|
||||
this.logger.info("执行超时,断开连接");
|
||||
conn.end();
|
||||
}, 1000 * (connectConf.timeout || 600));
|
||||
return await callable(conn);
|
||||
} finally {
|
||||
clearTimeout(timeoutId);
|
||||
conn.end();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user