Skip to content

Commit

Permalink
Merge branch 'main' into jon/printerr
Browse files Browse the repository at this point in the history
  • Loading branch information
sreya authored Aug 15, 2024
2 parents 614284e + ad17f3b commit 05f749d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions buildlog/coder.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,14 @@ func (c *agentClientV2) Send(level codersdk.LogLevel, log string) error {
if err != nil {
return xerrors.Errorf("send build log: %w", err)
}
err = c.flush()
if err != nil {
return xerrors.Errorf("flush: %w", err)
}
return nil
}

func (c *agentClientV2) Close() error {
defer c.cancel()
func (c *agentClientV2) flush() error {
c.ls.Flush(c.source)
err := c.ls.WaitUntilEmpty(c.ctx)
if err != nil {
Expand All @@ -96,6 +99,11 @@ func (c *agentClientV2) Close() error {
return nil
}

func (c *agentClientV2) Close() error {
defer c.cancel()
return c.flush()
}

func newAgentClientV2(ctx context.Context, logger slog.Logger, client *agentsdk.Client) (CoderClient, error) {
cctx, cancel := context.WithCancel(ctx)
uid := uuid.New()
Expand Down

0 comments on commit 05f749d

Please sign in to comment.