add extra logging

This commit is contained in:
Harvey Tindall
2021-04-06 18:02:15 +01:00
parent 78049d4a33
commit e6e5231f63
3 changed files with 16 additions and 13 deletions
+5 -10
View File
@@ -35,7 +35,6 @@ func (rt *userDaemon) run() {
break
}
started := time.Now()
rt.app.storage.loadInvites()
rt.app.checkUsers()
finished := time.Now()
duration := finished.Sub(started)
@@ -76,12 +75,8 @@ func (app *appContext) checkUsers() {
}
for id, expiry := range app.storage.users {
if _, ok := userExists[id]; !ok {
app.debug.Printf("Deleting expiry for non-existent user \"%s\"", id)
app.info.Printf("Deleting expiry for non-existent user \"%s\"", id)
delete(app.storage.users, id)
err = app.storage.storeUsers()
if err != nil {
app.err.Printf("Failed to store user duration: %s", err)
}
} else if time.Now().After(expiry) {
found := false
var user mediabrowser.User
@@ -111,10 +106,6 @@ func (app *appContext) checkUsers() {
continue
}
delete(app.storage.users, id)
err = app.storage.storeUsers()
if err != nil {
app.err.Printf("Failed to store user duration: %s", err)
}
if email {
address, ok := app.storage.emails[id]
if !ok {
@@ -131,4 +122,8 @@ func (app *appContext) checkUsers() {
}
}
}
err = app.storage.storeUsers()
if err != nil {
app.err.Printf("Failed to store user expiries: %s", err)
}
}