From 3d73ec887aec27483642820269ff832c349ae857 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 14 Feb 2024 13:36:20 +0200 Subject: [PATCH] Ensure integer values are used for cache_autotuning settings in homeserver.yaml We're casting everything it `int`, but since Jinja templates are involved, these values end up as strings anyway. Doing `| int | to_json` is good, but we should only cast numbers to integer, not empty strings, as that (0) may be interpreted differently by Synapse. To turn of auto-tuning, one is possibly supposed to pass empty strings: > This option defaults to off, enable it by providing values for the sub-options listed below. It could be that `0` is also considered "no value provided", but I haven't verified that. Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3017 --- .../matrix-synapse/templates/synapse/homeserver.yaml.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 index 5206dce3f..bf2a359f5 100644 --- a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 +++ b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 @@ -813,8 +813,8 @@ caches: sync_response_cache_duration: {{ matrix_synapse_caches_sync_response_cache_duration | to_json }} cache_autotuning: - max_cache_memory_usage: {{ matrix_synapse_cache_autotuning_max_cache_memory_usage | to_json }} - target_cache_memory_usage: {{ matrix_synapse_cache_autotuning_target_cache_memory_usage | to_json }} + max_cache_memory_usage: {{ ((matrix_synapse_cache_autotuning_max_cache_memory_usage | int | to_json) if matrix_synapse_cache_autotuning_max_cache_memory_usage else '') }} + target_cache_memory_usage: {{ ((matrix_synapse_cache_autotuning_target_cache_memory_usage | int | to_json) if matrix_synapse_cache_autotuning_target_cache_memory_usage else '') }} min_cache_ttl: {{ matrix_synapse_cache_autotuning_min_cache_ttl | to_json }}