MCPcopy Index your code
hub / github.com/coder/coder / update

Method update

provisionerd/runner/runner.go:352–376  ·  view source on GitHub ↗
(ctx context.Context, u *proto.UpdateJobRequest)

Source from the content-addressed store, hash-verified

350}
351
352func (r *Runner) update(ctx context.Context, u *proto.UpdateJobRequest) (*proto.UpdateJobResponse, error) {
353 ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
354 defer cancel()
355
356 ctx, span := r.startTrace(ctx, tracing.FuncName())
357 defer span.End()
358 defer func() {
359 r.lastUpdate.Store(ptr.Ref(time.Now()))
360 }()
361
362 span.SetAttributes(
363 attribute.Int64("logs_len", int64(len(u.Logs))),
364 attribute.Int64("template_variables_len", int64(len(u.TemplateVariables))),
365 attribute.Int64("user_variable_values_len", int64(len(u.UserVariableValues))),
366 attribute.Int64("readme_len", int64(len(u.Readme))),
367 )
368
369 r.mutex.Lock()
370 defer r.mutex.Unlock()
371 if !r.okToSend {
372 return nil, errUpdateSkipped
373 }
374
375 return r.sender.UpdateJob(ctx, u)
376}
377
378// doCleanFinish wraps a call to do() with cleaning up the job and setting the terminal messages
379func (r *Runner) doCleanFinish(ctx context.Context) {

Callers 3

sendHeartbeatMethod · 0.95
runTemplateImportMethod · 0.95
flushQueuedLogsMethod · 0.95

Calls 8

startTraceMethod · 0.95
FuncNameFunction · 0.92
RefFunction · 0.92
Int64Method · 0.80
UpdateJobMethod · 0.65
StoreMethod · 0.45
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected