Skip to content

Commit

Permalink
catch expiration bug (#676)
Browse files Browse the repository at this point in the history
* fix: add logs and catch error

* ci.yaml: remove unnecessary steps in the CI workflow

service.ts: remove unnecessary try-catch block for checking key expiration
  • Loading branch information
chronark authored Dec 12, 2023
1 parent d70df54 commit 3ba0fc3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:

- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: '^1.20'
Expand Down
10 changes: 1 addition & 9 deletions apps/api/src/pkg/keys/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,7 @@ export class KeyService {
/**
* Expiration
*/
try {
if (data.key.expires && data.key.expires.getTime() < Date.now()) {
return result.success({ valid: false, code: "NOT_FOUND" });
}
} catch (e) {
this.logger.error("Failed to check key expiration", {
error: (e as Error).message,
key: data.key.id,
});
if (data.key.expires && data.key.expires.getTime() < Date.now()) {
return result.success({ valid: false, code: "NOT_FOUND" });
}

Expand Down

0 comments on commit 3ba0fc3

Please sign in to comment.