housekeep: centralize datetime generation

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-01-18 05:59:52 -08:00
parent 7bcc8d7ce7
commit 7f6c23d4cb
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
41 changed files with 146 additions and 179 deletions

View file

@ -1,6 +1,5 @@
import hashlib
from datetime import datetime
from typing import List, Set
import bcrypt
@ -14,7 +13,7 @@ import aurweb.config
import aurweb.models.account_type
import aurweb.schema
from aurweb import db, logging, schema, util
from aurweb import db, logging, schema, time, util
from aurweb.models.account_type import AccountType as _AccountType
from aurweb.models.ban import is_banned
from aurweb.models.declarative import Base
@ -121,7 +120,7 @@ class User(Base):
exc = None
for i in range(tries):
exc = None
now_ts = datetime.utcnow().timestamp()
now_ts = time.utcnow()
try:
with db.begin():
self.LastLogin = now_ts