code: func recentInvQuery(c context.Context, j *Job, lastScanned int64) *invListQuery {
  	finished, err := filteredFinishedInvs(
  		j.FinishedInvocationsRaw, clock.Now(c).Add(-FinishedInvocationsHorizon))
  	if err != nil {
  		logging.WithError(err).Errorf(c, "Failed to unmarshal FinishedInvocationsRaw, skipping")
  		return &invListQuery{}
  	}
  
  	var invs []*Invocation
  	for _, inv := range finished {
  		if inv.InvocationId > lastScanned {
  			invs = append(invs, &Invocation{ID: inv.InvocationId})
  		}
  	}
  	sort.Slice(invs, func(l, r int) bool { return invs[l].ID < invs[r].ID })
  	return &invListQuery{invs: invs}
  }
docs: // recentInvQuery returns invQuery that emits recently finished invocations, as
  // fetched from the job.FinishedInvocationsRaw field.
  //
  // Smallest IDs are returned first. IDs smaller than or equal to lastScanned are
  // skipped (this is used for pagination).