mirror of
https://github.com/Luchexx/wacrm.git
synced 2026-11-02 09:19:51 +00:00
The advance loop called loadNode() on every iteration — one DB round trip per node visited. A flow with 5 chained auto-advance nodes (send_message → condition → set_tag → send_message → end) cost 5 sequential round trips synchronous in the webhook hot path. At ~50ms each that's 250ms before the customer sees anything. Switch to a single upfront SELECT into a Map<node_key, FlowNodeRow> keyed on the flow_id, passed through advanceFromNodeKey and handleReplyForActiveRun. The advance loop is now in-memory and the hot path costs one round trip regardless of chain length. node_not_found semantics are preserved: missing keys still end the run with that reason, same as the old per-node lookup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| admin-client.ts | ||
| engine.test.ts | ||
| engine.ts | ||
| fallback.test.ts | ||
| fallback.ts | ||
| feature-flag.test.ts | ||
| feature-flag.ts | ||
| meta-send.ts | ||
| templates.ts | ||
| types.ts | ||
| validate.test.ts | ||
| validate.ts | ||