code: func (e *engineImpl) execTriageJobStateTask(c context.Context, tqTask proto.Message) (err error) {
  	jobID := tqTask.(*internal.TriageJobStateTask).JobId
  
  	c = logging.SetField(c, "JobID", jobID)
  
  	op := triageOp{
  		jobID:              jobID,
  		dispatcher:         e.cfg.Dispatcher,
  		policyFactory:      policy.New,
  		maxAllowedTriggers: 1000, // experimentally derived number
  		enqueueInvocations: func(c context.Context, job *Job, req []task.Request) error {
  			_, err := e.enqueueInvocations(c, job, req)
  			return err
  		},
  	}
  
  	// Store the triage log no matter what (even if 'prepare' fails or the
  	// transaction fails to land). We want to surface these conditions if they
  	// happen consistently.
  	defer func() { op.finalize(c, err == nil) }()
  
  	if err = op.prepare(c); err != nil {
  		return err
  	}
  
  	err = e.jobTxn(c, jobID, func(c context.Context, job *Job, isNew bool) error {
  		if isNew {
  			logging.Warningf(c, "The job is unexpectedly gone")
  			return errSkipPut
  		}
  		return op.transaction(c, job)
  	})
  	if err != nil {
  		op.debugErrLog(c, err, "The triage transaction FAILED")
  	}
  	return err
  }
docs: // execTriageJobStateTask performs the triage of a job.
  //
  // It is throttled to run at most once per 2 seconds.
  //
  // It looks at pending triggers and recently finished invocations and launches
  // new invocations (or schedules timers to do it later).