1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: remove cleanup functionality

chore: minor code changes
This commit is contained in:
Ferdinand Mütsch
2020-11-06 14:07:07 +01:00
parent cb8f68df82
commit e6a04cc76d
6 changed files with 15 additions and 47 deletions

17
main.go
View File

@@ -56,11 +56,6 @@ func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
}
// Show data loss warning
if config.App.CleanUp {
promptAbort("`CLEANUP` is set to `true`, which may cause data loss. Are you sure to continue?", 5)
}
// Connect to database
var err error
db, err = gorm.Open(config.Db.GetDialector(), &gorm.Config{})
@@ -102,10 +97,6 @@ func main() {
// Aggregate heartbeats to summaries and persist them
go aggregationService.Schedule()
if config.App.CleanUp {
go heartbeatService.ScheduleCleanUp()
}
// TODO: move endpoint registration to the respective routes files
// Handlers
@@ -194,11 +185,3 @@ func runDatabaseMigrations() {
log.Fatal(err)
}
}
func promptAbort(message string, timeoutSec int) {
log.Printf("[WARNING] %s.\nTo abort server startup, press Ctrl+C.\n", message)
for i := timeoutSec; i > 0; i-- {
log.Printf("Starting in %d seconds ...\n", i)
time.Sleep(1 * time.Second)
}
}