Skip to content

Commit

Permalink
fix: send build failure event when quarkus can not start for subseque…
Browse files Browse the repository at this point in the history
…nt builds (#3942)

fixes #3935
Previously only the first build attempt would send a build failure event
if quarkus could not successfully start.
  • Loading branch information
matt2e authored Jan 8, 2025
1 parent b1960fb commit e15f4b9
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions jvm-runtime/plugin/common/jvmcommon.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,18 +369,16 @@ func (s *Service) runQuarkusDev(ctx context.Context, req *connect.Request[langpb
for {
select {
case <-ctx.Done():
if firstAttempt {
// the context is done before we notified the build engine
// we need to send a build failure event
err = stream.Send(&langpb.BuildResponse{Event: &langpb.BuildResponse_BuildFailure{
BuildFailure: &langpb.BuildFailure{
IsAutomaticRebuild: !firstAttempt,
ContextId: buildCtx.ID,
Errors: &langpb.ErrorList{Errors: []*langpb.Error{{Msg: "The dev mode process exited", Level: langpb.Error_ERROR_LEVEL_ERROR, Type: langpb.Error_ERROR_TYPE_COMPILER}}},
}}})
if err != nil {
return fmt.Errorf("could not send build event: %w", err)
}
// the context is done before we notified the build engine
// we need to send a build failure event
err = stream.Send(&langpb.BuildResponse{Event: &langpb.BuildResponse_BuildFailure{
BuildFailure: &langpb.BuildFailure{
IsAutomaticRebuild: !firstAttempt,
ContextId: buildCtx.ID,
Errors: &langpb.ErrorList{Errors: []*langpb.Error{{Msg: "The dev mode process exited", Level: langpb.Error_ERROR_LEVEL_ERROR, Type: langpb.Error_ERROR_TYPE_COMPILER}}},
}}})
if err != nil {
return fmt.Errorf("could not send build event: %w", err)
}
return nil
case bc := <-events:
Expand Down Expand Up @@ -440,7 +438,7 @@ func (s *Service) runQuarkusDev(ctx context.Context, req *connect.Request[langpb
moduleProto, err := readSchema(buildCtx)
if err != nil {
// This is likely a transient error
logger.Errorf(err, "failed to schema")
logger.Errorf(err, "failed to read schema")
continue
}

Expand Down

0 comments on commit e15f4b9

Please sign in to comment.