Skip to content

Commit

Permalink
feat: close DB connection after use
Browse files Browse the repository at this point in the history
  • Loading branch information
flxw committed Sep 25, 2023
1 parent bc74081 commit 56c1396
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ func RefreshMaterializedViews() {

db.Exec("REFRESH MATERIALIZED VIEW keyless_usage_per_month_mv")
db.Exec("REFRESH MATERIALIZED VIEW maximum_date_index_mv")

defer func() {
dbInstance, _ := db.DB()
_ = dbInstance.Close()
}()
}

func CommenceCrawlRun() {
Expand Down Expand Up @@ -105,6 +110,11 @@ func CommenceCrawlRun() {

db.Create(&crawledEntries)
slog.Info("Finished crawl run and persisted the entries")

defer func() {
dbInstance, _ := db.DB()
_ = dbInstance.Close()
}()
}

func SpawnRekorCrawlerRoutines(fromIndex int64, toIndex int64, rekorClient *rekorClient.Rekor, rekordQueue chan CrawledEntry) {
Expand Down

0 comments on commit 56c1396

Please sign in to comment.