KamoCRM

Stop scanning every market x product after the answer is known

PerformanceSecurityService
Ya
21 Agosti 2026, 01:36 UTC
Mwandishi
Kamo
Ahadi ya
5a8186f

/leads/available-summary returns three things — hasAcceptable, hasAcceptableCredit and one example product — but visited every market x product pair regardless, issuing 2-4 queries each (eligibility, allotment, and up to two credit counts). At the current 6 markets / 33 products that is roughly 75-140 queries per call, on a path the lead-alert context re-fires from four realtime events on a 350 ms debounce. The scan now stops once all three answers are set, because nothing later can change them. Pure short-circuit: every path that assigns them is untouched, and a run that never satisfies the condition behaves exactly as before. In the common case — the member has credit on the first product — it collapses ~30 iterations to one. Deliberately NOT a rewrite of the loop body. It carries state-licensing eligibility and allotment-precedence logic, and the safe win here was the one I could reason about completely.

Mabadiliko yote

Je, unaona nini kuhusu usafiri?

Kila kitu kinaingia kwenye tovuti yako mwenyewe. Anza kwenye mpango wa bure na usome ukurasa huu tena katika mwezi mmoja.

Kuwa Huru MileleMtazamo wa bei