diff options
author | Shay <hillerys@element.io> | 2022-01-25 10:35:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-25 10:35:18 -0800 |
commit | b8bf6007002131b8931f4b5f49a77bf5aba85067 (patch) | |
tree | a80d7cefdf803aa1107d38f7074015802690f174 /synapse/app/_base.py | |
parent | Add admin API to get a list of federated rooms (#11658) (diff) | |
download | synapse-b8bf6007002131b8931f4b5f49a77bf5aba85067.tar.xz |
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>
Diffstat (limited to '')
-rw-r--r-- | synapse/app/_base.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py index 9efdd071cc..bbab8a052a 100644 --- a/synapse/app/_base.py +++ b/synapse/app/_base.py @@ -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: |