Skip to content

Commit

Permalink
Merge pull request #71 from nyaruka/courier_flow_fix
Browse files Browse the repository at this point in the history
Still queue a courier message even if fetching the flow fails
  • Loading branch information
rowanseymour authored May 11, 2023
2 parents 146a06c + 85ec069 commit 1028765
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/msgio/courier.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ func NewCourierMsg(oa *models.OrgAssets, m *models.Msg, channel *models.Channel)
}

if m.FlowID() != models.NilFlowID {
flow, err := oa.FlowByID(m.FlowID())
if err != nil {
return nil, errors.Wrap(err, "error loading message flow")
}
msg.Flow = flow.Reference()
msg.Origin = MsgOriginFlow
flow, _ := oa.FlowByID(m.FlowID()) // always a chance flow no longer exists
if flow != nil {
msg.Flow = flow.Reference()
}
} else if m.BroadcastID() != models.NilBroadcastID {
msg.Origin = MsgOriginBroadcast
} else if m.TicketID() != models.NilTicketID {
Expand Down

0 comments on commit 1028765

Please sign in to comment.