- 修改了timeout时间

This commit is contained in:
yshtcn 2023-09-21 21:42:31 +08:00
parent 120089f301
commit 9eb59fbafc

View File

@ -83,8 +83,8 @@ except FileNotFoundError:
def get_updates(offset=None): def get_updates(offset=None):
try: try:
url = URL + "getUpdates" url = URL + "getUpdates"
params = {'offset': offset, 'timeout': 25} params = {'offset': offset, 'timeout': 90}
r = requests.get(url, params=params, proxies=proxies,timeout=30) r = requests.get(url, params=params, proxies=proxies,timeout=100)
return r.json() return r.json()
except Exception as e: except Exception as e:
print(f"Error getting updates: {e}") print(f"Error getting updates: {e}")
@ -227,14 +227,14 @@ def main():
process_message_queue() process_message_queue()
else: else:
print(f"{URL} Received updates: {updates}") print(f"{URL} Received updates: {updates}")
print("Error or no updates; retrying in 5 seconds...") print("Error or no updates; retrying in 10 seconds...")
time.sleep(5) # 等待5秒再重试 time.sleep(10) # 等待5秒再重试
print("Process message queue...") print("Process message queue...")
process_message_queue() process_message_queue()
# 每30s检查一次 # 每30s检查一次
print("Nexttime in 5 seconds...") print("Nexttime in 3 seconds...")
time.sleep(5) time.sleep(3)
# 运行主函数 # 运行主函数
if __name__ == '__main__': if __name__ == '__main__':