fix: throttle desktop monitoring dispatch
Desktop Client Build / Resolve Build Metadata (push) Successful in 27s
Backend CI / Backend (push) Successful in 15m57s
Desktop Client Build / Build Desktop Client (push) Successful in 22m57s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 27s

This commit is contained in:
2026-06-22 12:21:59 +08:00
parent 54c2f92e02
commit 8c6789dca6
23 changed files with 591 additions and 88 deletions
@@ -0,0 +1,2 @@
ALTER TABLE monitoring_collect_tasks
DROP COLUMN IF EXISTS question_text_snapshot;
@@ -0,0 +1,28 @@
ALTER TABLE monitoring_collect_tasks
ADD COLUMN IF NOT EXISTS question_text_snapshot TEXT NOT NULL DEFAULT '';
UPDATE monitoring_collect_tasks t
SET question_text_snapshot = s.question_text_snapshot
FROM (
SELECT DISTINCT ON (tenant_id, brand_id, question_id, question_hash)
tenant_id,
brand_id,
question_id,
question_hash,
question_text_snapshot
FROM monitoring_question_config_snapshots
WHERE btrim(question_text_snapshot) <> ''
ORDER BY
tenant_id,
brand_id,
question_id,
question_hash,
CASE WHEN deleted_at IS NULL THEN 0 ELSE 1 END,
projected_at DESC,
id DESC
) s
WHERE t.tenant_id = s.tenant_id
AND t.brand_id = s.brand_id
AND t.question_id = s.question_id
AND t.question_hash = s.question_hash
AND btrim(t.question_text_snapshot) = '';