| 350 | } |
| 351 | |
| 352 | func (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 |
| 379 | func (r *Runner) doCleanFinish(ctx context.Context) { |