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: Dan Callahan <danc@element.io> Co-authored-by: Dan Callahan <danc@element.io>
This commit is contained in:
parent
6a72c910f1
commit
b8bf600700
|
@ -0,0 +1 @@
|
|||
Drop support for Python 3.6, which is EOL.
|
|
@ -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()
|
||||
# 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)
|
||||
# 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:
|
||||
|
|
Loading…
Reference in New Issue