mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 08:01:25 +00:00
dfd08d8a4b
* refactor: improve usage table behavior to eliminate synchronous row locks Replace synchronous INSERT...RETURNING with SELECT + async UPDATE pattern: - Add check_usage_limits() to read current usage without row locks - Add increment_usage_async() to update usage in background task - Refactor job push logic to use optimistic validation - Simplify job completion tracking with better error handling This eliminates blocking row locks on the usage table during job creation, significantly improving throughput and reducing contention. Note: Requires running 'cargo sqlx prepare' with database access to update the query cache in .sqlx/ directory. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Ruben Fiszel <rubenfiszel@users.noreply.github.com> * Update SQLx metadata * refactor: optimize cloud usage checks with caching and conditional queries - Add 60s cache for superadmin status checks to reduce DB load - Skip unnecessary user usage query for premium workspaces - Use existing team plan status cache (already implemented in windmill-common) - Update check_usage_limits to accept check_user_usage parameter - Add sqlx query cache for conditional user usage query This optimization eliminates redundant database queries during job creation, particularly for premium workspaces where user usage tracking is not needed. Co-authored-by: Ruben Fiszel <rubenfiszel@users.noreply.github.com> --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Ruben Fiszel <rubenfiszel@users.noreply.github.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>