Corrected refresh rate limiting for utc.
This commit is contained in:
parent
d3d6b142d9
commit
47ccd0f7be
@ -93,12 +93,11 @@ class User(db.Model):
|
|||||||
self.vocabulary = json.dumps(items)
|
self.vocabulary = json.dumps(items)
|
||||||
|
|
||||||
def update_all(self):
|
def update_all(self):
|
||||||
if (datetime.now() - self.last_updated) > timedelta(hours=1):
|
if (datetime.utcnow() - self.last_updated) > timedelta(hours=1):
|
||||||
self.parse_radicals_and_userdata()
|
self.parse_radicals_and_userdata()
|
||||||
self.parse_kanji()
|
self.parse_kanji()
|
||||||
self.parse_vocabulary()
|
self.parse_vocabulary()
|
||||||
self.last_updated = datetime.utcnow()
|
self.last_updated = datetime.utcnow()
|
||||||
db.session.add(self)
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
else:
|
else:
|
||||||
raise ValueError('Cannot refresh now, try again later.')
|
raise ValueError('Cannot refresh now, try again later.')
|
||||||
|
Loading…
Reference in New Issue
Block a user