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

Method Cleanup

scaletest/chat/run.go:379–397  ·  view source on GitHub ↗
(ctx context.Context, id string, logs io.Writer)

Source from the content-addressed store, hash-verified

377}
378
379func (r *Runner) Cleanup(ctx context.Context, id string, logs io.Writer) error {
380 if r.chatID == uuid.Nil {
381 return nil
382 }
383
384 logs = loadtestutil.NewSyncWriter(logs)
385 logger := slog.Make(sloghuman.Sink(logs)).Leveled(slog.LevelDebug).Named(id).With(slog.F("chat_id", r.chatID))
386 r.client.SetLogger(logger)
387 r.client.SetLogBodies(true)
388
389 archived := true
390 logger.Info(ctx, "archiving chat session")
391 if err := r.client.UpdateChat(ctx, r.chatID, codersdk.UpdateChatRequest{Archived: &archived}); err != nil {
392 logger.Error(ctx, "failed to archive chat", slog.Error(err))
393 return xerrors.Errorf("archive chat: %w", err)
394 }
395 logger.Info(ctx, "archived chat session")
396 return nil
397}
398
399func (r *Runner) GetMetrics() map[string]any {
400 return map[string]any{

Callers 1

TestRunFunction · 0.95

Calls 8

NewSyncWriterFunction · 0.92
NamedMethod · 0.80
SetLoggerMethod · 0.65
SetLogBodiesMethod · 0.65
UpdateChatMethod · 0.65
InfoMethod · 0.45
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by 1

TestRunFunction · 0.76