Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Check that gc method is available before using in synapse/app/_base #11816

Merged
merged 5 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions changelog.d/11816.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop support for Python 3.6, which is EOL.
14 changes: 8 additions & 6 deletions synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,14 @@ def run_sighup(*args: Any, **kwargs: Any) -> None:
# everything currently allocated are things that will be used for the
# rest of time. Doing so means less work each GC (hopefully).
#
gc.collect()
gc.freeze()

# Speed up shutdowns by freezing all allocated objects. This moves everything
# into the permanent generation and excludes them from the final GC.
atexit.register(gc.freeze)
# gc.freeze may not be available in all Python implementations, thus we check here
H-Shay marked this conversation as resolved.
Show resolved Hide resolved
if hasattr(gc, 'freeze'):
gc.collect()
gc.freeze()

# Speed up shutdowns by freezing all allocated objects. This moves everything
# into the permanent generation and excludes them from the final GC.
atexit.register(gc.freeze)


def setup_sentry(hs: "HomeServer") -> None:
Expand Down