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

Method PublishWorkspaceClaim

coderd/prebuilds/claim.go:24–34  ·  view source on GitHub ↗
(claim agentsdk.ReinitializationEvent)

Source from the content-addressed store, hash-verified

22}
23
24func (p PubsubWorkspaceClaimPublisher) PublishWorkspaceClaim(claim agentsdk.ReinitializationEvent) error {
25 channel := agentsdk.PrebuildClaimedChannel(claim.WorkspaceID)
26 payload, err := json.Marshal(claim)
27 if err != nil {
28 return xerrors.Errorf("marshal claim event: %w", err)
29 }
30 if err := p.ps.Publish(channel, payload); err != nil {
31 return xerrors.Errorf("failed to trigger prebuilt workspace agent reinitialization: %w", err)
32 }
33 return nil
34}
35
36func NewPubsubWorkspaceClaimListener(ps pubsub.Pubsub, logger slog.Logger) *PubsubWorkspaceClaimListener {
37 return &PubsubWorkspaceClaimListener{ps: ps, logger: logger}

Callers 3

TestReinitFunction · 0.80

Calls 4

PrebuildClaimedChannelFunction · 0.92
PublishMethod · 0.65
MarshalMethod · 0.45
ErrorfMethod · 0.45

Tested by 2

TestReinitFunction · 0.64