diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index 502a74d..9476a4a 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -25,5 +25,12 @@
org.postgresql.Driver
jdbc:postgresql://ssh.sanplex.xyz:9432/music_prod
+
+ postgresql
+ true
+ org.postgresql.Driver
+ jdbc:postgresql://localhost:5432/music_test2
+ $ProjectFileDir$
+
\ No newline at end of file
diff --git a/internal/backend/sync.go b/internal/backend/sync.go
index 8a3db84..f4caf31 100644
--- a/internal/backend/sync.go
+++ b/internal/backend/sync.go
@@ -26,6 +26,7 @@ import (
var Syncing = false
var foldersSynced float32
var numberOfFoldersToSync float32
+var start time.Time
var totalTime time.Duration
var timeSpent time.Duration
@@ -82,13 +83,15 @@ func ResetDB() {
func SyncProgress() ProgressResponse {
progress := int((foldersSynced / numberOfFoldersToSync) * 100)
+ currentTime := time.Now()
+ timeSpent = currentTime.Sub(start)
out := time.Time{}.Add(timeSpent)
- fmt.Printf("\nTotal time: %v\n", timeSpent)
+ fmt.Printf("\nTime spent: %v\n", timeSpent)
fmt.Printf("Total time: %v\n", out.Format("15:04:05.00000"))
log.Printf("Progress: %v/%v %v%%\n", int(foldersSynced), int(numberOfFoldersToSync), progress)
return ProgressResponse{
Progress: fmt.Sprintf("%v", progress),
- TimeSpent: out.Format("15:04:05.00000"),
+ TimeSpent: fmt.Sprintf("%v", timeSpent),
}
}
@@ -123,12 +126,12 @@ func SyncResult() SyncResponse {
for _, afterGame := range gamesAfterSync {
if beforeGame.GameName == afterGame.GameName {
found = true
- fmt.Printf("Game: %s, Found: %v break\n", beforeGame.GameName, found)
+ //fmt.Printf("Game: %s, Found: %v break\n", beforeGame.GameName, found)
break
}
}
if !found {
- fmt.Printf("Game: %s, Found: %v\n", beforeGame.GameName, found)
+ //fmt.Printf("Game: %s, Found: %v\n", beforeGame.GameName, found)
gamesRemovedTemp = append(gamesRemovedTemp, beforeGame.GameName)
}
}
@@ -168,7 +171,7 @@ func SyncResult() SyncResponse {
GamesChangedContent: gamesChangedContent,
GamesRemoved: gamesRemoved,
CatchedErrors: catchedErrors,
- TotalTime: out.Format("15:04:05.00000"),
+ TotalTime: fmt.Sprintf("%v", timeSpent),
}
}
@@ -194,7 +197,7 @@ func syncGamesNew(full bool) {
var syncWg sync.WaitGroup
initRepo()
- start := time.Now()
+ start = time.Now()
foldersToSkip := []string{".sync", "dist", "old", "characters"}
fmt.Println(foldersToSkip)
@@ -224,6 +227,7 @@ func syncGamesNew(full bool) {
pool, _ := ants.NewPool(50, ants.WithPreAlloc(true))
defer pool.Release()
+ foldersSynced = 0
numberOfFoldersToSync = float32(len(directories))
syncWg.Add(int(numberOfFoldersToSync))
for _, dir := range directories {