Skip to content

Commit

Permalink
fix: Insert provisioner job logs async (#185)
Browse files Browse the repository at this point in the history
The context could be cancelled after a log is sent, which resulted
in a failure. This prevent's that from occurring by using the
background context.
  • Loading branch information
kylecarbs committed Feb 7, 2022
1 parent d55231c commit 13360e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
3 changes: 1 addition & 2 deletions coderd/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,8 @@ func (server *provisionerdServer) UpdateJob(stream proto.DRPCProvisionerDaemon_U
insertParams.Source = append(insertParams.Source, logSource)
insertParams.Output = append(insertParams.Output, log.Output)
}
logs, err := server.Database.InsertProvisionerJobLogs(stream.Context(), insertParams)
logs, err := server.Database.InsertProvisionerJobLogs(context.Background(), insertParams)
if err != nil {
server.Logger.Error(stream.Context(), "insert provisioner job logs", slog.Error(err))
return xerrors.Errorf("insert job logs: %w", err)
}
data, err := json.Marshal(logs)
Expand Down
18 changes: 6 additions & 12 deletions database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions database/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 13360e2

Please sign in to comment.