mirror of
https://github.com/Luchexx/wacrm.git
synced 2026-11-02 17:29:45 +00:00
startNewRun read flows.execution_count from a cached row and wrote `cached + 1`. Two concurrent webhooks starting runs on the same flow for different contacts both read N and both write N+1 — one count permanently lost. Mirrors the automations engine's solution (migration 007): a tiny SECURITY DEFINER function that does the increment server-side, locked to the service role. The engine's call becomes a single RPC. The counter is best-effort: if the RPC fails we log + continue rather than failing the run for a stat error. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| migrations | ||