Skip to content

Commit

Permalink
closes added back
Browse files Browse the repository at this point in the history
  • Loading branch information
rvilim committed Sep 19, 2024
1 parent 17f44a5 commit d0e61b1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/impl/sql/cache_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ func newSQLCacheFromConfig(conf *service.ParsedConfig, mgr *service.Resources) (
}
connSettings.apply(context.Background(), s.db, s.logger)

go func() {
<-s.shutSig.HardStopChan()
s.shutSig.TriggerHasStopped()
}()

return s, nil
}

Expand Down
4 changes: 4 additions & 0 deletions internal/impl/sql/input_sql_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ func (s *sqlRawInput) Connect(ctx context.Context) (err error) {
_ = s.rows.Close()
s.rows = nil
}
if s.db != nil {
_ = s.db.Close()
s.db = nil
}
s.dbMut.Unlock()

s.shutSig.TriggerHasStopped()
Expand Down
3 changes: 3 additions & 0 deletions internal/impl/sql/input_sql_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ func (s *sqlSelectInput) Connect(ctx context.Context) (err error) {
_ = s.rows.Close()
s.rows = nil
}
if s.db != nil {
_ = s.db.Close()
}
s.dbMut.Unlock()

s.shutSig.TriggerHasStopped()
Expand Down
2 changes: 2 additions & 0 deletions internal/impl/sql/output_sql_insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ func (s *sqlInsertOutput) Connect(ctx context.Context) error {

go func() {
<-s.shutSig.HardStopChan()
_ = s.db.Close()

s.shutSig.TriggerHasStopped()
}()

Expand Down
2 changes: 2 additions & 0 deletions internal/impl/sql/output_sql_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ func (s *sqlRawOutput) Connect(ctx context.Context) error {

go func() {
<-s.shutSig.HardStopChan()
_ = s.db.Close()

s.shutSig.TriggerHasStopped()
}()

Expand Down
2 changes: 2 additions & 0 deletions internal/impl/sql/processor_sql_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ func newSQLRawProcessor(

go func() {
<-s.shutSig.HardStopChan()
_ = s.db.Close()

s.shutSig.TriggerHasStopped()
}()
return s, nil
Expand Down

0 comments on commit d0e61b1

Please sign in to comment.