Sfoglia il codice sorgente

Optimize matrix-bot-chatgpt container stopping time

pull/3025/head
Slavi Pantaleev 2 anni fa
parent
commit
6b04afb49a
2 ha cambiato i file con 6 aggiunte e 2 eliminazioni
  1. +4
    -0
      roles/custom/matrix-bot-chatgpt/defaults/main.yml
  2. +2
    -2
      roles/custom/matrix-bot-chatgpt/templates/systemd/matrix-bot-chatgpt.service.j2

+ 4
- 0
roles/custom/matrix-bot-chatgpt/defaults/main.yml Vedi File

@@ -22,6 +22,10 @@ matrix_bot_chatgpt_config_path: "{{ matrix_bot_chatgpt_base_path }}/config"
matrix_bot_chatgpt_data_path: "{{ matrix_bot_chatgpt_base_path }}/data" matrix_bot_chatgpt_data_path: "{{ matrix_bot_chatgpt_base_path }}/data"
matrix_bot_chatgpt_container_src_path: "{{ matrix_bot_chatgpt_base_path }}/container-src" matrix_bot_chatgpt_container_src_path: "{{ matrix_bot_chatgpt_base_path }}/container-src"


# 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_bot_chatgpt_container_stop_grace_time_seconds: 1

# A list of extra arguments to pass to the container # A list of extra arguments to pass to the container
matrix_bot_chatgpt_container_extra_arguments: [] matrix_bot_chatgpt_container_extra_arguments: []




+ 2
- 2
roles/custom/matrix-bot-chatgpt/templates/systemd/matrix-bot-chatgpt.service.j2 Vedi File

@@ -13,7 +13,7 @@ DefaultDependencies=no
[Service] [Service]
Type=simple Type=simple
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}" Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-bot-chatgpt 2>/dev/null || true'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ matrix_bot_chatgpt_container_stop_grace_time_seconds }} matrix-bot-chatgpt 2>/dev/null || true'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-chatgpt 2>/dev/null || true' ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-chatgpt 2>/dev/null || true'


ExecStart={{ devture_systemd_docker_base_host_command_docker }} run \ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run \
@@ -33,7 +33,7 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run \
{% endfor %} {% endfor %}
{{ matrix_bot_chatgpt_container_image }} {{ matrix_bot_chatgpt_container_image }}


ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-bot-chatgpt 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ matrix_bot_chatgpt_container_stop_grace_time_seconds }} matrix-bot-chatgpt 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-chatgpt 2>/dev/null || true' ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-chatgpt 2>/dev/null || true'
Restart=always Restart=always
RestartSec=30 RestartSec=30


Caricamento…
Annulla
Salva