start jobs with started state (#3070)

* start jobs with started state

* deps
This commit is contained in:
Paul Wells
2024-10-07 04:09:10 -07:00
committed by GitHub
parent 5e22582c66
commit 4c2b154c41
4 changed files with 9 additions and 8 deletions
+5 -4
View File
@@ -336,12 +336,13 @@ func (w *Worker) AssignJob(ctx context.Context, job *livekit.Job) (*livekit.JobS
w.mu.Unlock()
}()
now := time.Now()
if job.State == nil {
job.State = &livekit.JobState{
UpdatedAt: now.UnixNano(),
}
job.State = &livekit.JobState{}
}
now := time.Now()
job.State.UpdatedAt = now.UnixNano()
job.State.StartedAt = now.UnixNano()
job.State.Status = livekit.JobStatus_JS_RUNNING
w.sendRequest(&livekit.ServerMessage{Message: &livekit.ServerMessage_Availability{
Availability: &livekit.AvailabilityRequest{Job: job},
+1 -1
View File
@@ -1010,7 +1010,7 @@ func (r *Room) DeleteAgentDispatch(dispatchID string) (*livekit.AgentDispatch, e
r.lock.RUnlock()
for _, j := range jobs {
state, err := r.agentClient.TerminateJob(context.Background(), j.Id, rpc.JobTerminateReason_TERINATION_REQUESTED)
state, err := r.agentClient.TerminateJob(context.Background(), j.Id, rpc.JobTerminateReason_TERMINATION_REQUESTED)
if err != nil {
continue
}