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

Method query

coderd/provisionerjobs.go:676–694  ·  view source on GitHub ↗

query fetches the latest job logs from the database and writes them to the connection.

()

Source from the content-addressed store, hash-verified

674// query fetches the latest job logs from the database and writes them to the
675// connection.
676func (f *logFollower) query() error {
677 f.logger.Debug(f.ctx, "querying logs", slog.F("after", f.after))
678 logs, err := f.db.GetProvisionerLogsAfterID(f.ctx, database.GetProvisionerLogsAfterIDParams{
679 JobID: f.jobID,
680 CreatedAfter: f.after,
681 })
682 if err != nil && !errors.Is(err, sql.ErrNoRows) {
683 return xerrors.Errorf("error fetching logs: %w", err)
684 }
685 for _, log := range logs {
686 err := f.enc.Encode(convertProvisionerJobLog(log))
687 if err != nil {
688 return xerrors.Errorf("error writing to websocket: %w", err)
689 }
690 f.after = log.ID
691 f.logger.Debug(f.ctx, "wrote log to websocket", slog.F("id", log.ID))
692 }
693 return nil
694}

Callers 2

followMethod · 0.95
doPasteFunction · 0.80

Calls 5

convertProvisionerJobLogFunction · 0.85
EncodeMethod · 0.80
IsMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected