Skip to content

Commit

Permalink
Refactor redis
Browse files Browse the repository at this point in the history
  • Loading branch information
minhduc140583 committed Sep 1, 2024
1 parent 9267115 commit 23ae0b9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A health check in microservices is a mechanism that ensures each service is func
- You can refer to [Microservice Health Check](https://www.linkedin.com/pulse/microservice-health-check-go-nodejs-duc-nguyen-qunvc) at my [Linked In](https://vn.linkedin.com/in/duc-nguyen-437240239?trk=article-ssr-frontend-pulse_publisher-author-card) for more details.


![health](https://cdn-images-1.medium.com/max/800/1*k-VjYL3UL9Zohwzas4nb8Q.png)
![health](https://cdn-images-1.medium.com/max/800/1*NreJfea6tHobxMpiq96PPQ.png)

### Use Cases of Health Check
#### Service Availability Monitoring:
Expand Down
2 changes: 1 addition & 1 deletion redigo/health_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package redis

import (
"context"
"github.com/garyburd/redigo/redis"
"github.com/gomodule/redigo/redis"
"time"
)

Expand Down
4 changes: 2 additions & 2 deletions redis/v8/health_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ type HealthChecker struct {
timeout time.Duration
}

func NewRedisHealthChecker(db *redis.Client, name string, timeouts ...time.Duration) *HealthChecker {
func NewRedisHealthChecker(client *redis.Client, name string, timeouts ...time.Duration) *HealthChecker {
var timeout time.Duration
if len(timeouts) >= 1 {
timeout = timeouts[0]
} else {
timeout = 4 * time.Second
}
return &HealthChecker{client: db, name: name, timeout: timeout}
return &HealthChecker{client: client, name: name, timeout: timeout}
}

func NewHealthChecker(db *redis.Client, options ...string) *HealthChecker {
Expand Down
6 changes: 3 additions & 3 deletions redis/v9/health_checker.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v9
package redis

import (
"context"
Expand All @@ -13,14 +13,14 @@ type HealthChecker struct {
timeout time.Duration
}

func NewRedisHealthChecker(db *redis.Client, name string, timeouts ...time.Duration) *HealthChecker {
func NewRedisHealthChecker(client *redis.Client, name string, timeouts ...time.Duration) *HealthChecker {
var timeout time.Duration
if len(timeouts) >= 1 {
timeout = timeouts[0]
} else {
timeout = 4 * time.Second
}
return &HealthChecker{client: db, name: name, timeout: timeout}
return &HealthChecker{client: client, name: name, timeout: timeout}
}

func NewHealthChecker(db *redis.Client, options ...string) *HealthChecker {
Expand Down

0 comments on commit 23ae0b9

Please sign in to comment.