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
This commit is contained in:
Slavi Pantaleev 2024-02-14 13:36:20 +02:00
parent 1cd82cf068
commit 3d73ec887a

View File

@ -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 }}