Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datetime.datetime.utcnow() deprecation (fix #13804) #13805

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import traceback
from bodyfetcher import BodyFetcher
import chatcommunicate
from datetime import datetime
from datetime import datetime, timezone
from spamhandling import check_if_spam_json
from globalvars import GlobalVars
from datahandling import (load_pickle, PICKLE_STORAGE, load_files, filter_auto_ignored_posts,
Expand Down Expand Up @@ -232,7 +232,7 @@ def check_socket_connections():
socket_failure = False
with chatcommunicate._clients_lock:
for client in chatcommunicate._clients.values():
if client.last_activity and (datetime.utcnow() - client.last_activity).total_seconds() >= 60:
if client.last_activity and (datetime.now(timezone.utc) - client.last_activity).total_seconds() >= 60:
socket_failure = True
if socket_failure:
exit_mode("socket_failure")
Expand Down Expand Up @@ -319,7 +319,7 @@ def init_se_websocket_or_reboot(max_tries, tell_debug_room_on_error=False):

except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
now = datetime.utcnow()
now = datetime.now(timezone.utc)
delta = now - GlobalVars.startup_utc_date
seconds = delta.total_seconds()
tr = traceback.format_exc()
Expand Down