mirror of
https://github.com/openziti/ziti.git
synced 2026-09-25 03:42:38 +00:00
20 lines
680 B
Go
20 lines
680 B
Go
package persistence
|
|
|
|
import (
|
|
"github.com/openziti/storage/ast"
|
|
"github.com/openziti/storage/boltz"
|
|
)
|
|
|
|
// Primes API Session's lastActivityAt proper to their previous updatedAt value
|
|
func (m *Migrations) setLastActivityAt(step *boltz.MigrationStep) {
|
|
for cursor := m.stores.ApiSession.IterateIds(step.Ctx.Tx(), ast.BoolNodeTrue); cursor.IsValid(); cursor.Next() {
|
|
if apiSession, err := m.stores.ApiSession.LoadOneById(step.Ctx.Tx(), string(cursor.Current())); err == nil {
|
|
apiSession.LastActivityAt = apiSession.UpdatedAt
|
|
step.SetError(m.stores.ApiSession.Update(step.Ctx, apiSession, UpdateLastActivityAtChecker{}))
|
|
} else {
|
|
step.SetError(err)
|
|
return
|
|
}
|
|
}
|
|
}
|