Skip to content

Commit d13903d

Browse files
fix(doccano-django): gate record-traffic on a real readiness signal
Pipeline 3597 / 909 (post-compose-render fix) failed at: Container ... Error dependency postgres failed to start Misleading. Real cause: doccano_record_traffic fired its very first POST /v1/projects against a backend whose port was open but gunicorn was still booting; the 5xx response failed `curl -fsS`, set -e killed the script silently, the lane saw a zero-second "traffic done", SIGINTed keploy ~3s later, and the recording captured nothing. The "dependency postgres failed" line in the log is downstream noise from the SIGINT compose-down. Fix: gate doccano_record_traffic on doccano_wait_for_fixed_token before any curl fires. /v1/me with the fixed Authorization header is a stronger readiness signal than wait_for_port: it proves gunicorn is past boot, auth is wired, the named-volume token is loaded, and the DB is responsive — all four guarantees the first POST needs. Lane scripts can keep their own port-level wait (wait_for_port), but the sample's flow.sh now refuses to fire traffic until the backend is genuinely serving. Local smoke-test pattern is unchanged: bootstrap + record-traffic still work standalone. Signed-off-by: Akash Kumar <meakash7902@gmail.com>
1 parent 2cc92c3 commit d13903d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

doccano-django/flow.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ doccano_record_traffic() {
9999
local example_resp example_id
100100
local p
101101

102+
# Wait for the backend to actually be SERVING (not just
103+
# port-open). Lanes typically wait_for_port before invoking
104+
# this function, but a TCP-open backend could still be
105+
# gunicorn-booting and 5xx every API call. doccano_wait_for_fixed_token
106+
# polls /v1/me with the deterministic auth header until it
107+
# returns 200, which is the strongest single-call readiness
108+
# signal: it proves gunicorn is past boot, the auth backend
109+
# is wired, the named-volume token is loaded, and the DB is
110+
# responsive. Without this gate, the very first POST below
111+
# (curl -fsS, no `|| true`) fails with a 5xx, set -e kills
112+
# the script, the lane's compat_run_record_phase sees a
113+
# zero-second "traffic done", SIGINTs keploy ~3s after, and
114+
# the recording captures nothing.
115+
doccano_wait_for_fixed_token 240 >/dev/null
116+
102117
# Worker-cache warmup. doccano runs 4 gunicorn workers; each
103118
# worker keeps its own per-process Django ContentType cache and
104119
# populates it lazily on the first polymorphic-resolver query

0 commit comments

Comments
 (0)