Increase route expiration time
This commit is contained in:
parent
bad5852033
commit
f56a280be5
3
app.py
3
app.py
|
@ -36,7 +36,7 @@ class Train(db.Model):
|
|||
id = Column(String, primary_key=True)
|
||||
day = Column(Date, index=True)
|
||||
number = Column(Integer, index=True)
|
||||
entity = Column(String(10))
|
||||
entity = Column(String(16))
|
||||
axe = Column(String(32), index=True)
|
||||
orig_iata = Column(String(5), index=True)
|
||||
dest_iata = Column(String(5), index=True)
|
||||
|
@ -270,6 +270,7 @@ def process_queue(number: int):
|
|||
data = resp.json()
|
||||
req.response_time = datetime.utcfromtimestamp(data['updatedAt'] // 1000).replace(tzinfo=timezone('UTC'))
|
||||
req.expiration_time = datetime.utcfromtimestamp(data['expiresAt'] // 1000).replace(tzinfo=timezone('UTC'))
|
||||
req.expiration_time += timedelta(hours=3) # By default 5 minutes, extend it to 3 hours to be safe
|
||||
db.session.add(req)
|
||||
|
||||
db.session.query(Train).filter_by(day=req.day, orig_iata=req.origin, dest_iata=req.destination)\
|
||||
|
|
Loading…
Reference in New Issue