From f56a280be56f6cda410f0468c98669e21411e8a5 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sun, 12 Feb 2023 23:48:10 +0100 Subject: [PATCH] Increase route expiration time --- app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 394e4d1..7b9b607 100644 --- a/app.py +++ b/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)\