From e78a8212954ac01e1294cbb839134f66b06a5779 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Tue, 31 May 2022 09:19:57 -0600 Subject: [PATCH] config: add option for how long to wait until media ID expires --- docs/usage/configuration/config_documentation.md | 10 ++++++++++ synapse/config/repository.py | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/docs/usage/configuration/config_documentation.md b/docs/usage/configuration/config_documentation.md index f5951869e978..5d05bc51e2c0 100644 --- a/docs/usage/configuration/config_documentation.md +++ b/docs/usage/configuration/config_documentation.md @@ -1764,6 +1764,16 @@ Example configuration: media_store_path: "DATADIR/media_store" ``` --- +### `unused_expiration_time` + +How long to wait in milliseconds before expiring created media IDs. Defaults to +"24h" + +Example configuration: +```yaml +unused_expiration_time: "1h" +``` +--- ### `media_storage_providers` Media storage providers allow media to be stored in different diff --git a/synapse/config/repository.py b/synapse/config/repository.py index f6cfdd3e048a..dba9926779ba 100644 --- a/synapse/config/repository.py +++ b/synapse/config/repository.py @@ -141,6 +141,10 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None: "prevent_media_downloads_from", [] ) + self.unused_expiration_time = self.parse_duration( + config.get("unused_expiration_time", "24h") + ) + self.media_store_path = self.ensure_directory( config.get("media_store_path", "media_store") )