Skip to content

Commit

Permalink
RHINENG-5394: run vacuum in goroutine so api won't time out
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy committed Dec 11, 2023
1 parent 76c837d commit b4e2877
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion turnpike/controllers/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ func MigrateSystemPackage(c *gin.Context) {
var cnt int64
db := database.Db

execQuery(db, "VACUUM ANALYZE system_package;")
db.Table("system_package2").Count(&cnt)
if cnt > 0 {
utils.LogInfo("System_package2 table is not empty")
Expand All @@ -312,6 +311,7 @@ func MigrateSystemPackage(c *gin.Context) {

// nolint:lll
go func() {
execQuery(db, "VACUUM ANALYZE system_package;")
execQuery(db, "ALTER TABLE system_package2 DROP CONSTRAINT system_package2_applicable_id_fkey;")
execQuery(db, "ALTER TABLE system_package2 DROP CONSTRAINT system_package2_installable_id_fkey;")
execQuery(db, "ALTER TABLE system_package2 DROP CONSTRAINT system_package2_name_id_fkey;")
Expand Down

0 comments on commit b4e2877

Please sign in to comment.