Просмотр исходного кода

Optimize matrix-bot-chatgpt container stopping time

pull/3025/head
Slavi Pantaleev 2 лет назад
Родитель
Сommit
6b04afb49a
2 измененных файлов: 6 добавлений и 2 удалений
  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 Просмотреть файл

@@ -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_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
matrix_bot_chatgpt_container_extra_arguments: []



+ 2
- 2
roles/custom/matrix-bot-chatgpt/templates/systemd/matrix-bot-chatgpt.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_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'

ExecStart={{ devture_systemd_docker_base_host_command_docker }} run \
@@ -33,7 +33,7 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run \
{% endfor %}
{{ 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'
Restart=always
RestartSec=30


Загрузка…
Отмена
Сохранить