Close database after migrating. Add reset errors (#215)

This commit is contained in:
WithoutPants
2019-11-18 08:39:33 +11:00
committed by Leopere
parent 6a75d5551f
commit 6dcb270471
2 changed files with 25 additions and 7 deletions

View File

@@ -3,6 +3,10 @@ package manager
import (
"context"
"database/sql"
"strconv"
"sync"
"time"
"github.com/jmoiron/sqlx"
"github.com/stashapp/stash/pkg/database"
"github.com/stashapp/stash/pkg/logger"
@@ -10,9 +14,6 @@ import (
"github.com/stashapp/stash/pkg/manager/jsonschema"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/utils"
"strconv"
"sync"
"time"
)
type ImportTask struct {
@@ -34,7 +35,12 @@ func (t *ImportTask) Start(wg *sync.WaitGroup) {
}
t.Scraped = scraped
database.Reset(config.GetDatabasePath())
err := database.Reset(config.GetDatabasePath())
if err != nil {
logger.Errorf("Error resetting database: %s", err.Error())
return
}
ctx := context.TODO()