Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Jan 14, 2025
1 parent 968e201 commit 6c76297
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions jvm-runtime/plugin/common/jvmcommon.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func (s *Service) GenerateStubs(ctx context.Context, req *connect.Request[langpb

func (s *Service) SyncStubReferences(ctx context.Context, req *connect.Request[langpb.SyncStubReferencesRequest]) (*connect.Response[langpb.SyncStubReferencesResponse], error) {

if req.Msg.Schema == nil {
return connect.NewResponse(&langpb.SyncStubReferencesResponse{}), nil
}
sch, err := schema.FromProto(req.Msg.Schema)
if err != nil {
return nil, fmt.Errorf("failed to parse schema from proto: %w", err)
Expand Down Expand Up @@ -430,6 +433,13 @@ func (s *Service) runQuarkusDev(ctx context.Context, req *connect.Request[langpb
}
}
if changed || forceUpdate {
auto := !firstAttempt && !forceUpdate
if auto {
err = stream.Send(&langpb.BuildResponse{Event: &langpb.BuildResponse_AutoRebuildStarted{AutoRebuildStarted: &langpb.AutoRebuildStarted{ContextId: buildCtx.ID}}})
if err != nil {
return fmt.Errorf("could not send build event: %w", err)
}
}
buildErrs, err := loadProtoErrors(buildCtx.Config)
if err != nil {
// This is likely a transient error
Expand All @@ -440,7 +450,7 @@ func (s *Service) runQuarkusDev(ctx context.Context, req *connect.Request[langpb
// skip reading schema
err = stream.Send(&langpb.BuildResponse{Event: &langpb.BuildResponse_BuildFailure{
BuildFailure: &langpb.BuildFailure{
IsAutomaticRebuild: !firstAttempt,
IsAutomaticRebuild: auto,
ContextId: buildCtx.ID,
Errors: buildErrs,
}}})
Expand All @@ -459,7 +469,6 @@ func (s *Service) runQuarkusDev(ctx context.Context, req *connect.Request[langpb
}

logger.Infof("Live reload schema changed, sending build success event")
auto := !firstAttempt && !forceUpdate
err = stream.Send(&langpb.BuildResponse{
Event: &langpb.BuildResponse_BuildSuccess{
BuildSuccess: &langpb.BuildSuccess{
Expand Down Expand Up @@ -596,7 +605,10 @@ func (s *Service) BuildContextUpdated(ctx context.Context, req *connect.Request[
return nil, err
}

s.writeGenericSchemaFiles(ctx, buildCtx.Schema, buildCtx.Config)
err = s.writeGenericSchemaFiles(ctx, buildCtx.Schema, buildCtx.Config)
if err != nil {
return nil, fmt.Errorf("failed to write generic schema files: %w", err)
}

s.updatesTopic.Publish(buildContextUpdatedEvent{
buildCtx: buildCtx,
Expand Down

0 comments on commit 6c76297

Please sign in to comment.