Wait in the right place

This commit is contained in:
Tracker-Friendly 2024-03-30 19:53:07 +00:00
parent 4c6f0123a0
commit 5c843c18eb
1 changed files with 1 additions and 1 deletions

2
main
View File

@ -75,6 +75,7 @@ def check_username_taken(username):
async def oauth2_token_refresh(openid, appId): async def oauth2_token_refresh(openid, appId):
while True: while True:
await asyncio.sleep(3600)
conn = get_db_connection() conn = get_db_connection()
# Fetch required data in a single query # Fetch required data in a single query
@ -102,7 +103,6 @@ async def oauth2_token_refresh(openid, appId):
conn.execute("UPDATE logins SET code = ?, nextcode = ?, secret = ?, nextsecret = ?, openid = ?, nextopenid = ? WHERE appId = ? AND openid = ?", (nextcode, str(secrets.token_hex(512)), nextsecret, str(secrets.token_hex(512)), nextopenid, str(jwt_token), str(appId), str(openid))) conn.execute("UPDATE logins SET code = ?, nextcode = ?, secret = ?, nextsecret = ?, openid = ?, nextopenid = ? WHERE appId = ? AND openid = ?", (nextcode, str(secrets.token_hex(512)), nextsecret, str(secrets.token_hex(512)), nextopenid, str(jwt_token), str(appId), str(openid)))
conn.commit() conn.commit()
conn.close() conn.close()
await asyncio.sleep(3600)
else: else:
conn.close() conn.close()
return return