cmd/coordinator: favor trybot work over post-submit work on process start

Updates golang/go#19178

Change-Id: I054c852db398a9474e53254c42eb5f77c44fe348
Reviewed-on: https://go-review.googlesource.com/c/build/+/207464
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/cmd/coordinator/coordinator.go b/cmd/coordinator/coordinator.go
index 3915e26..9f493b5 100644
--- a/cmd/coordinator/coordinator.go
+++ b/cmd/coordinator/coordinator.go
@@ -845,11 +845,16 @@
 	// do some new streaming gRPC call to maintnerd to subscribe
 	// to new commits.
 	ticker := time.NewTicker(15 * time.Second)
-	for {
+	// We wait for the ticker first, before looking for work, to
+	// give findTryWork a head start. Because try work is more
+	// important and the scheduler can't (yet?) preempt an
+	// existing post-submit build to take it over for a trybot, we
+	// want to make sure that reverse buildlets get assigned to
+	// trybots/slowbots first on start-up.
+	for range ticker.C {
 		if err := findWork(); err != nil {
 			log.Printf("failed to find new work: %v", err)
 		}
-		<-ticker.C
 	}
 }