Skip to content

Commit

Permalink
Fix replica conn leak (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
jespino authored Mar 6, 2024
1 parent 7c615a4 commit 21b2e41
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 35 deletions.
4 changes: 2 additions & 2 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func (p *Plugin) stop(isRestart bool) {
}

if !isRestart {
if err := p.store.Shutdown(); err != nil {
if err := p.apiClient.Store.Close(); err != nil {
p.API.LogError("failed to close db connection", "error", err)
}
}
Expand Down Expand Up @@ -578,7 +578,7 @@ func (p *Plugin) OnActivate() error {
if err := p.onActivate(); err != nil {
p.API.LogWarn("error activating the plugin", "error", err)
if p.store != nil {
if err = p.store.Shutdown(); err != nil {
if err = p.apiClient.Store.Close(); err != nil {
p.API.LogWarn("failed to close db connection", "error", err)
}
}
Expand Down
14 changes: 0 additions & 14 deletions server/store/mocks/Store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions server/store/sqlstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ func New(db *sql.DB, api plugin.API, enabledTeams func() []string, encryptionKey
}
}

func (s *SQLStore) Shutdown() error {
return s.db.Close()
}

func (s *SQLStore) createTable(tableName, columnList string) error {
if _, err := s.db.Exec(fmt.Sprintf("CREATE TABLE IF NOT EXISTS %s (%s)", tableName, columnList)); err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion server/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ type Store interface {
IsUserPresentInWhitelist(userID string) (bool, error)
UpdateSubscriptionLastActivityAt(subscriptionID string, lastActivityAt time.Time) error
GetSubscriptionsLastActivityAt() (map[string]time.Time, error)
Shutdown() error
}
14 changes: 0 additions & 14 deletions server/store/timerlayer/timerlayer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 21b2e41

Please sign in to comment.