code: func (d *DesiredState) PollForNumberCreated(taskID platform.ID, count int) ([]scheduler.QueuedRun, error) {
  	const numAttempts = 50
  	actualCount := 0
  	var created []scheduler.QueuedRun
  	for i := 0; i < numAttempts; i++ {
  		time.Sleep(2 * time.Millisecond) // we sleep even on first so it becomes more likely that we catch when too many are produced.
  		created = d.CreatedFor(taskID)
  		actualCount = len(created)
  		if actualCount == count {
  			return created, nil
  		}
  	}
  	return created, fmt.Errorf("did not see count of %d created task(s) for ID %s in time, instead saw %d", count, taskID.String(), actualCount) // we return created anyways, to make it easier to debug
  }
docs: // PollForNumberCreated blocks for a small amount of time waiting for exactly the given count of created runs for the given task ID.
  // If the expected number isn't found in time, it returns an error.
  //
  // Because the scheduler and executor do a lot of state changes asynchronously, this is useful in test.