mirror of
https://github.com/Luchexx/wacrm.git
synced 2026-11-02 09:19:51 +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> |
||
|---|---|---|
| .. | ||
| 001_initial_schema.sql | ||
| 002_pipelines_enhancements.sql | ||
| 003_broadcast_recipient_wamid.sql | ||
| 004_contact_delete_set_null.sql | ||
| 005_broadcast_counts_incremental.sql | ||
| 006_automations.sql | ||
| 007_automations_increment_counter.sql | ||
| 008_profile_avatars_storage.sql | ||
| 009_message_actions.sql | ||
| 010_flows.sql | ||
| 011_profile_beta_features.sql | ||
| 012_flows_increment_counter.sql | ||