mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-11 20:42:23 +01:00
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
2 changed files with 8 additions and 5 deletions
1
changelog.d/11816.misc
Normal file
1
changelog.d/11816.misc
Normal file
|
@ -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
|
# everything currently allocated are things that will be used for the
|
||||||
# rest of time. Doing so means less work each GC (hopefully).
|
# rest of time. Doing so means less work each GC (hopefully).
|
||||||
#
|
#
|
||||||
gc.collect()
|
# PyPy does not (yet?) implement gc.freeze()
|
||||||
gc.freeze()
|
if hasattr(gc, "freeze"):
|
||||||
|
gc.collect()
|
||||||
|
gc.freeze()
|
||||||
|
|
||||||
# Speed up shutdowns by freezing all allocated objects. This moves everything
|
# Speed up shutdowns by freezing all allocated objects. This moves everything
|
||||||
# into the permanent generation and excludes them from the final GC.
|
# into the permanent generation and excludes them from the final GC.
|
||||||
atexit.register(gc.freeze)
|
atexit.register(gc.freeze)
|
||||||
|
|
||||||
|
|
||||||
def setup_sentry(hs: "HomeServer") -> None:
|
def setup_sentry(hs: "HomeServer") -> None:
|
||||||
|
|
Loading…
Reference in a new issue