Repository navigation
fix: bound the env apply so a slow server cannot stall the request (#211) - #222
Merged
Merged
Conversation
) - EnvApply runs the remote command under a 25s deadline and returns {:error, :timeout} instead of letting the request hang (configurable via :env_apply_timeout_ms) - the readiness loop drops from 30s to 20s so a failed apply still returns the journal tail within the deadline - API answers 504 env_apply_timeout on timeout; other applies keep 502 - apply failures log at warning level with the app slug Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema (#211)
PUT /api/v1/apps/:id/envexecuta a gravação remota de forma síncrona dentro da request. Sem um teto de tempo, um servidor lento/indisponível (ou unit recém-criada, ver #213) mantinha a request aberta até ~32s até o proxy/cliente devolver 502.Mudanças
EnvApplyexecuta o comando remoto com deadline de 25s (:env_apply_timeout_ms) viaTask.yield+Task.shutdown— mesmo padrão deApps.Query. Ao estourar, retorna{:error, :timeout}e loga warning com o slug.env_apply_timeout(as vars ficam gravadas); demais falhas seguem 502env_apply_failed.Alternativa assíncrona (202 + job) foi considerada, mas muda o contrato do CLI/MCP; fica como evolução futura se o caso "apply demorado" voltar a incomodar.
Testes
mix test --exclude integration→ 901 testes, 0 falhasEnvApplye 504 na APICloses #211.