Skip to content

Commit

Permalink
More closes
Browse files Browse the repository at this point in the history
  • Loading branch information
rvilim committed Sep 19, 2024
1 parent d0e61b1 commit 2ac07c2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/impl/sql/cache_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func newSQLCacheFromConfig(conf *service.ParsedConfig, mgr *service.Resources) (

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

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

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

s.dbMut.Unlock()
s.shutSig.TriggerHasStopped()
}()

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

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

s.dbMut.Lock()
_ = s.db.Close()
s.dbMut.Unlock()

s.shutSig.TriggerHasStopped()
}()
Expand Down
3 changes: 3 additions & 0 deletions internal/impl/sql/processor_sql_insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ func NewSQLInsertProcessorFromConfig(conf *service.ParsedConfig, mgr *service.Re

go func() {
<-s.shutSig.HardStopChan()
s.dbMut.Lock()
_ = s.db.Close()
s.dbMut.Unlock()
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,7 +174,9 @@ func newSQLRawProcessor(

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

s.shutSig.TriggerHasStopped()
}()
Expand Down
4 changes: 4 additions & 0 deletions internal/impl/sql/processor_sql_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ func NewSQLSelectProcessorFromConfig(conf *service.ParsedConfig, mgr *service.Re

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

s.shutSig.TriggerHasStopped()
}()

Expand Down

0 comments on commit 2ac07c2

Please sign in to comment.