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
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:
@@ -203,6 +203,44 @@ func TestBuildCountPublishTasksByStatusesQueryHidesDeletedPublishRecords(t *test
|
||||
}
|
||||
}
|
||||
|
||||
func TestLeaseNextQueuedMonitorTaskSQLSerializesPerClientPlatform(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
normalized := normalizeSQLForDesktopTaskTest(leaseNextQueuedMonitorTaskSQL())
|
||||
for _, fragment := range []string{
|
||||
"NOT EXISTS ( SELECT 1 FROM desktop_tasks AS active",
|
||||
"active.target_client_id = $3",
|
||||
"active.platform_id = dt.platform_id",
|
||||
"active.status = 'in_progress'",
|
||||
"active.desktop_id <> dt.desktop_id",
|
||||
"recent.status IN ('succeeded', 'failed', 'unknown', 'aborted')",
|
||||
"recent.updated_at >= now() - interval '30 seconds'",
|
||||
} {
|
||||
if !strings.Contains(normalized, fragment) {
|
||||
t.Fatalf("monitor lease query missing %q: %s", fragment, normalized)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLeaseQueuedDesktopTaskByIDSQLSerializesMonitorPerClientPlatform(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
normalized := normalizeSQLForDesktopTaskTest(leaseQueuedDesktopTaskByIDSQL())
|
||||
for _, fragment := range []string{
|
||||
"dt.kind <> 'monitor' OR NOT EXISTS",
|
||||
"active.target_client_id = $4",
|
||||
"active.platform_id = dt.platform_id",
|
||||
"active.status = 'in_progress'",
|
||||
"active.desktop_id <> dt.desktop_id",
|
||||
"recent.status IN ('succeeded', 'failed', 'unknown', 'aborted')",
|
||||
"recent.updated_at >= now() - interval '30 seconds'",
|
||||
} {
|
||||
if !strings.Contains(normalized, fragment) {
|
||||
t.Fatalf("task-specific lease query missing %q: %s", fragment, normalized)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func recoverDesktopTaskSelectColumns(query string) []string {
|
||||
re := regexp.MustCompile(`(?is)select\s+(.*?)\s+from\s+desktop_tasks`)
|
||||
match := re.FindStringSubmatch(query)
|
||||
|
||||
Reference in New Issue
Block a user