Skip to content

Commit

Permalink
fixup! Squashing client close errors
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonb committed Jun 21, 2023
1 parent be6057d commit c4f7168
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/utils/client.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import { WorkflowClient, WorkflowClientOptions } from '@temporalio/client';

export function assignOnAppShutdownHook(client: WorkflowClient) {
(client as unknown as OnApplicationShutdown).onApplicationShutdown =
async () => {
try {
await client.connection?.close();
} catch (e) {
console.error(
`Temporal client connection was not cleanly closed: ${e.stack}`,
async () =>
client.connection
?.close()
.catch((reason) =>
console.error(
`Temporal client connection was not cleanly closed: ${reason}`,
),
);
}
};
return client;
}

Expand Down

0 comments on commit c4f7168

Please sign in to comment.