Small changes to sync progress
All checks were successful
Build / build (push) Successful in 52s

This commit is contained in:
2025-09-19 22:10:27 +02:00
parent 5f91643b4d
commit a6294e46f2
2 changed files with 17 additions and 6 deletions

7
.idea/dataSources.xml generated
View File

@@ -25,5 +25,12 @@
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://ssh.sanplex.xyz:9432/music_prod</jdbc-url>
</data-source>
<data-source source="LOCAL" name="music_test2@localhost" uuid="a423ab0a-55b0-42e1-8070-25d8ef34bfac">
<driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://localhost:5432/music_test2</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

View File

@@ -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 {