Skip to content

Commit 6ea679f

Browse files
committed
feat: add RedisStore.Close and release the pool on PostgresStore.Close
1 parent 0a0ec88 commit 6ea679f

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

pg/store.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type PostgresStore struct {
2424
func (ims *PostgresStore) Close() {
2525
ims.closeOnce.Do(func() {
2626
close(ims.done)
27+
ims.pool.Close()
2728
})
2829
}
2930

redis/store.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ type RedisStore struct {
6262
retentionTTL time.Duration
6363
}
6464

65+
func (rs *RedisStore) Close() error {
66+
return rs.client.Close()
67+
}
68+
6569
func (rs *RedisStore) Claim(ctx context.Context, key string, requestHash string, token string) (idempo.ClaimResult, error) {
6670
result, err := rs.client.Eval(ctx, claimScript, []string{key}, requestHash, rs.lockTTL.Milliseconds(), token).Result()
6771

0 commit comments

Comments
 (0)