Skip to content

Commit

Permalink
Merge pull request #8 from flxw/close-db-connections
Browse files Browse the repository at this point in the history
feat: close DB connection after use
  • Loading branch information
flxw committed Sep 25, 2023
2 parents bc74081 + 56c1396 commit d4efede
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 d4efede

Please sign in to comment.