1d45f232c6
Funciones impuras para gestión de contenedores: docker_build_image, docker_compose_up/down, docker_volume_create/list/remove, generate_dockerfile, write_dockerfile, go_build_binary, health_check_http, deploy_app y stop_app. Todas con tests unitarios donde aplica. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.3 KiB
1.3 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| health_check_http | function | go | infra | 1.0.0 | impure | func HealthCheckHTTP(url string, timeoutSecs, intervalMs int) error | Hace polling HTTP GET a un endpoint hasta recibir status 200 o hasta agotar el timeout. Útil para esperar que un servicio levante antes de continuar un pipeline. |
|
false | error_go_core |
|
true |
|
functions/infra/health_check_http_test.go | functions/infra/health_check_http.go |
Ejemplo
// Esperar hasta 60s a que Metabase levante, polling cada 2s
err := HealthCheckHTTP("http://localhost:3000/api/health", 60, 2000)
if err != nil {
log.Fatal("Servicio no disponible:", err)
}
fmt.Println("Servicio listo")
Notas
Usa solo net/http de la stdlib, sin dependencias externas. El cliente HTTP tiene timeout de intervalMs + 500ms para no bloquear el loop. Retorna el ultimo error si el timeout expira. No sigue redirects especiales — cualquier respuesta 200 OK es exito.