Implement proper "reset" that reads snapshots from database
This commit is contained in:
18
main.go
18
main.go
@@ -56,6 +56,12 @@ func main() {
|
||||
logger.InitFlag()
|
||||
logger.Info("Initializing with log level: %s", logger.GetLevel().String())
|
||||
|
||||
db, err := utils.GetDB()
|
||||
if err != nil {
|
||||
logger.Error("Failed to get database: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
// The plan is:
|
||||
// Load all commands
|
||||
commands, err := utils.LoadCommands(args)
|
||||
@@ -105,6 +111,12 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
err = utils.ResetWhereNecessary(associations, db)
|
||||
if err != nil {
|
||||
logger.Error("Failed to reset files where necessary: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Then for each file run all commands associated with the file
|
||||
workers := make(chan struct{}, *utils.ParallelFiles)
|
||||
wg := sync.WaitGroup{}
|
||||
@@ -137,12 +149,6 @@ func main() {
|
||||
logger.Debug("Created logger for command %q with log level %s", cmdName, cmdLogLevel.String())
|
||||
}
|
||||
|
||||
db, err := utils.GetDB()
|
||||
if err != nil {
|
||||
logger.Error("Failed to get database: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
for file, association := range associations {
|
||||
workers <- struct{}{}
|
||||
wg.Add(1)
|
||||
|
Reference in New Issue
Block a user