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

Commit

Permalink
Fix track_memory_usage on poetry-core 1.3.x installations (#14221)
Browse files Browse the repository at this point in the history
* Fix `track_memory_usage` on poetry-core 1.3.x installations

The same kind of problem as discussed in #14085:

1. we defined an extra with an underscore
2. we look it up at runtime with an underscore
3. but poetry-core 1.3.x. installs it with a dash, causing (2) to fail.

Fix by using a dash everywhere.

* Changelog
  • Loading branch information
David Robertson authored Oct 18, 2022
1 parent a8677bc commit 8e50299
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/14221.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename the `cache_memory` extra to `cache-memory`, for compatability with poetry-core 1.3.0 and [PEP 685](https://peps.python.org/pep-0685/). From-source installations using this extra will need to install using the new name.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ jwt = ["authlib"]
# (if it is not installed, we fall back to slow code.)
redis = ["txredisapi", "hiredis"]
# Required to use experimental `caches.track_memory_usage` config option.
cache_memory = ["pympler"]
cache-memory = ["pympler"]
test = ["parameterized", "idna"]

# The duplication here is awful. I hate hate hate hate hate it. However, for now I want
Expand Down Expand Up @@ -258,7 +258,7 @@ all = [
"jaeger-client", "opentracing",
# redis
"txredisapi", "hiredis",
# cache_memory
# cache-memory
"pympler",
# omitted:
# - test: it's useful to have this separate from dev deps in the olddeps job
Expand Down
2 changes: 1 addition & 1 deletion synapse/config/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:

self.track_memory_usage = cache_config.get("track_memory_usage", False)
if self.track_memory_usage:
check_requirements("cache_memory")
check_requirements("cache-memory")

expire_caches = cache_config.get("expire_caches", True)
cache_entry_ttl = cache_config.get("cache_entry_ttl", "30m")
Expand Down

0 comments on commit 8e50299

Please sign in to comment.