aboutsummaryrefslogtreecommitdiff
path: root/cmd/atlas-import
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-24 05:40:39 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-24 05:40:39 -0400
commitc4df0faa5a2eaa0fb0bae9fbe858e9f423425c9f (patch)
treee3aa43300e4113712ccc6ef362ef236af0f5be02 /cmd/atlas-import
parent0ca336dd6f25a7fe7e8c09bffe7b5d96cd7617ee (diff)
downloadAtlas-c4df0faa5a2eaa0fb0bae9fbe858e9f423425c9f.tar.gz
Atlas-c4df0faa5a2eaa0fb0bae9fbe858e9f423425c9f.zip
cmd/atlas-import: Better auth token expiry logic
Diffstat (limited to 'cmd/atlas-import')
-rw-r--r--cmd/atlas-import/main.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/atlas-import/main.go b/cmd/atlas-import/main.go
index 24e2d81..5068b83 100644
--- a/cmd/atlas-import/main.go
+++ b/cmd/atlas-import/main.go
@@ -148,8 +148,8 @@ func insertA(n *nsacct, a *atlasdb.DB) error {
fmt.Fprintf(os.Stderr, "warning: uid %d (%s): failed to parse last auth ip %q (%v), ignoring\n", n.ID, n.Username, *n.LastAuthIP, err)
}
}
- x.AuthToken = n.CurrentAuthToken
- if v := time.Unix(n.CurrentAuthTokenExpirationTime, 0); time.Now().Before(v.Add(time.Hour * -24)) {
+ if v := time.Unix(n.CurrentAuthTokenExpirationTime/1000, 0); time.Until(v).Abs() < time.Hour*24 {
+ x.AuthToken = n.CurrentAuthToken
x.AuthTokenExpiry = v
}
if n.CurrentServerID != nil && *n.CurrentServerID != "" {