Commit 3bbef82d authored by xianyang's avatar xianyang

优化每天第一次报错问题

parent 77a301e1
...@@ -39,8 +39,7 @@ async def add_process_time_header(request: Request, call_next): ...@@ -39,8 +39,7 @@ async def add_process_time_header(request: Request, call_next):
payload = jwt.decode(token.replace('Bearer','').replace(' ',''), env.SECRET_KEY, algorithms=[env.ALGORITHM]) payload = jwt.decode(token.replace('Bearer','').replace(' ',''), env.SECRET_KEY, algorithms=[env.ALGORITHM])
except Exception as e: except Exception as e:
print(e) print(e)
finally: return response
payload = jwt.decode(token.replace('Bearer','').replace(' ',''), env.SECRET_KEY, algorithms=[env.ALGORITHM])
timestamp = payload.get("exp") timestamp = payload.get("exp")
access_token_expires = timedelta(hours=time_format(timestamp)) access_token_expires = timedelta(hours=time_format(timestamp))
create_access_token({'username':payload.get("xup"),'password':payload.get("password")},expires_delta=access_token_expires) #更新token时间 create_access_token({'username':payload.get("xup"),'password':payload.get("password")},expires_delta=access_token_expires) #更新token时间
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment