Skip to content

Commit

Permalink
Return error if no longer leader when publishing (#3794)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Martin <chris@cmartinit.co.uk>
Co-authored-by: Chris Martin <chris@cmartinit.co.uk>
  • Loading branch information
d80tb7 and d80tb7 authored Jul 18, 2024
1 parent 68dcc3e commit a6cac13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/scheduler/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (p *PulsarPublisher) PublishMessages(ctx *armadacontext.Context, events []*
return errors.New("One or more messages failed to send to Pulsar")
}
} else {
ctx.Debugf("No longer leader so not publishing")
return errors.New("Failed to publish as no longer leader")
}
return nil
}
Expand Down
1 change: 1 addition & 0 deletions internal/scheduler/publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestPulsarPublisher_TestPublish(t *testing.T) {
"Don't publish if not leader": {
amLeader: false,
numSuccessfulPublishes: math.MaxInt,
expectedError: true,
eventSequences: []*armadaevents.EventSequence{
{
JobSetName: "jobset1",
Expand Down

0 comments on commit a6cac13

Please sign in to comment.