Skip to content
Snippets Groups Projects
Unverified Commit b8bf6007 authored by Shay's avatar Shay Committed by GitHub
Browse files

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


* add check that gc.freeze is available before calling

* newsfragment

* lint

* Update comment

Co-authored-by: default avatarDan Callahan <danc@element.io>

Co-authored-by: default avatarDan Callahan <danc@element.io>
parent 6a72c910
No related branches found
No related tags found
No related merge requests found
Drop support for Python 3.6, which is EOL.
\ No newline at end of file
......@@ -468,12 +468,14 @@ async def start(hs: "HomeServer") -> 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)
# PyPy does not (yet?) implement gc.freeze()
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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment