fix: WriteTimeout 30s → 10m для совместимости с медленными соединениями

Скачивание нового прайслиста через VPN с высокой задержкой (>600 мс RTT)
превышало WriteTimeout=30s — браузер не получал ответ на POST /api/sync/all
и пользователь видел зависание без фидбека.

Сервер слушает только loopback, внешних клиентов нет — длинный таймаут
не создаёт угрозы безопасности.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 13:40:24 +03:00
parent 0072f2a15f
commit c5909c6a36

View File

@@ -332,7 +332,9 @@ func setConfigDefaults(cfg *config.Config) {
cfg.Server.ReadTimeout = 30 * time.Second
}
if cfg.Server.WriteTimeout == 0 {
cfg.Server.WriteTimeout = 30 * time.Second
// Sync operations (pricelist download over slow VPN) can take several minutes.
// Loopback-only binding means there is no risk of holding connections from external clients.
cfg.Server.WriteTimeout = 10 * time.Minute
}
if cfg.Backup.Time == "" {
cfg.Backup.Time = "00:00"
@@ -394,7 +396,7 @@ func ensureDefaultConfigFile(configPath string) error {
port: 8080
mode: "release"
read_timeout: 30s
write_timeout: 30s
write_timeout: 10m
backup:
time: "00:00"