Skip to content

Commit

Permalink
deleted redundant field
Browse files Browse the repository at this point in the history
  • Loading branch information
logica0419 committed Jul 26, 2022
1 parent 9cc81dd commit 111a3dc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func WaitDBStartUp(db *sql.DB) {
// DBDisconnectDetector DBから切断されるとアプリを強制終了する検出器
type DBDisconnectDetector struct {
db []*sql.DB
d int
t *Ticker
r time.Duration
s chan struct{}
Expand All @@ -36,13 +35,12 @@ NewDBDisconnectDetector 新たなDBDisconnectDetectorを作成
func NewDBDisconnectDetector(durationSec, pauseSec int) *DBDisconnectDetector {
d := DBDisconnectDetector{
db: make([]*sql.DB, 0),
d: durationSec,
r: time.Second * time.Duration(pauseSec),
s: make(chan struct{}),
st: false,
}

d.t = NewTicker(d.d*1000, func() {
d.t = NewTicker(durationSec*1000, func() {
for _, db := range d.db {
err := db.Ping()
if err != nil {
Expand Down

0 comments on commit 111a3dc

Please sign in to comment.