less save
Some checks failed
Build and Publish / BuildAndDeploy (push) Has been cancelled

This commit is contained in:
matst80
2024-11-11 18:00:33 +01:00
parent 5f48a845b1
commit f158a54e86
3 changed files with 8 additions and 3 deletions

View File

@@ -58,6 +58,8 @@ type App struct {
func (a *App) Save() error {
hasChanges := false
a.pool.mu.RLock()
defer a.pool.mu.RUnlock()
for id, grain := range a.pool.GetGrains() {
if grain == nil {
continue
@@ -70,6 +72,7 @@ func (a *App) Save() error {
}
}
}
if !hasChanges {
return nil
}
@@ -128,7 +131,7 @@ func main() {
}
go func() {
for range time.Tick(time.Minute) {
for range time.Tick(time.Minute * 10) {
err := app.Save()
if err != nil {