Skip to content

Commit

Permalink
Merge pull request #4 from fgiova/fix/fix-default-flag-for-destroy-si…
Browse files Browse the repository at this point in the history
…gner

fix: fix default destroy signer to false if signer is a singleton
  • Loading branch information
fgiova committed Dec 31, 2023
2 parents 5f8e24f + 4850274 commit 079dda5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
release:
runs-on: ubuntu-latest
needs: [test, build]
if: github.event_name == 'push' # Release only on Push
steps:
- name: Check out repo
uses: actions/checkout@v3
Expand All @@ -85,7 +86,6 @@ jobs:
- run: npm ci
- run: npm run build
- name: Semantic Release
if: ${{ github.event_name == 'push' }} # Semantic Release only on Push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class MiniSQSClient {
private readonly signer: Signer;
private region: string;
private endpoint: string;
private defaultDestroySigner = true;

constructor (region: string, endpoint?: string, undiciOptions?: Pool.Options, signer?: Signer | SignerOptions) {
this.undiciOptions = undiciOptions;
Expand All @@ -28,11 +29,12 @@ export class MiniSQSClient {
this.signer = new Signer(signer);
}
else {
this.defaultDestroySigner = false;
this.signer = SignerSingleton.getSigner();
}
}

async destroy (signer = true) {
async destroy (signer: boolean = this.defaultDestroySigner) {
return Promise.all([
this.pool.destroy(),
signer && this.signer.destroy() || true
Expand Down

0 comments on commit 079dda5

Please sign in to comment.