From c2605cd3ccaf13cdedd97c388b914cdcdf19e8e5 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 6 Dec 2023 12:13:06 +0200 Subject: [PATCH] Optimize matrix-heisenbridge container stopping time --- roles/custom/matrix-bridge-heisenbridge/defaults/main.yml | 4 ++++ .../templates/systemd/matrix-heisenbridge.service.j2 | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-bridge-heisenbridge/defaults/main.yml b/roles/custom/matrix-bridge-heisenbridge/defaults/main.yml index c8d1bf946..8ffcf3122 100644 --- a/roles/custom/matrix-bridge-heisenbridge/defaults/main.yml +++ b/roles/custom/matrix-bridge-heisenbridge/defaults/main.yml @@ -17,6 +17,10 @@ matrix_heisenbridge_identd_enabled: false matrix_heisenbridge_base_path: "{{ matrix_base_data_path }}/heisenbridge" +# Controls how long to wait for the container to stop gracefully before killing it. +# We use a small value here, because this container does not seem to handle the SIGTERM signal. +matrix_heisenbridge_container_stop_grace_time_seconds: 1 + # A list of extra arguments to pass to the container matrix_heisenbridge_container_extra_arguments: [] diff --git a/roles/custom/matrix-bridge-heisenbridge/templates/systemd/matrix-heisenbridge.service.j2 b/roles/custom/matrix-bridge-heisenbridge/templates/systemd/matrix-heisenbridge.service.j2 index 2c7367930..6bb6b81b1 100644 --- a/roles/custom/matrix-bridge-heisenbridge/templates/systemd/matrix-heisenbridge.service.j2 +++ b/roles/custom/matrix-bridge-heisenbridge/templates/systemd/matrix-heisenbridge.service.j2 @@ -13,7 +13,7 @@ DefaultDependencies=no [Service] Type=simple Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}" -ExecStartPre=-{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-heisenbridge +ExecStartPre=-{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ matrix_heisenbridge_container_stop_grace_time_seconds }} matrix-heisenbridge ExecStartPre=-{{ devture_systemd_docker_base_host_command_docker }} rm matrix-heisenbridge ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name matrix-heisenbridge \ @@ -41,7 +41,7 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name --listen-port 9898 \ {{ matrix_heisenbridge_homeserver_url }} -ExecStop=-{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-heisenbridge +ExecStop=-{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ matrix_heisenbridge_container_stop_grace_time_seconds }} matrix-heisenbridge ExecStop=-{{ devture_systemd_docker_base_host_command_docker }} rm matrix-heisenbridge Restart=always RestartSec=30