Skip to content

Commit

Permalink
(enh): double check if cached connection is still connected
Browse files Browse the repository at this point in the history
  • Loading branch information
matyson committed Oct 1, 2024
1 parent f9248df commit 5ca3135
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/deepsirius-ui/src/server/api/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ const ensureSSHConnection = t.middleware(async ({ ctx, next }) => {
}

let connection = sshCache.get(ctx.session.user.name);
if (!connection) {
if (!connection?.isConnected()) {
sshCache.delete(ctx.session.user.name);
connection = await ctx.ssh.connect({
username: ctx.session.user.name,
privateKey: ctx.privateKey,
Expand Down

0 comments on commit 5ca3135

Please sign in to comment.