Skip to content

Commit

Permalink
Use background instead of passive
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jan 7, 2021
1 parent 8d46fdd commit f7086c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions core/models/flows.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ type FlowType string

// flow type constants
const (
FlowTypeMessaging = FlowType("M")
FlowTypePassive = FlowType("P")
FlowTypeSurveyor = FlowType("S")
FlowTypeVoice = FlowType("V")
FlowTypeMessaging = FlowType("M")
FlowTypeBackground = FlowType("B")
FlowTypeSurveyor = FlowType("S")
FlowTypeVoice = FlowType("V")
)

// Interrupts returns whether this flow type interrupts existing sessions
func (t FlowType) Interrupts() bool {
return t != FlowTypePassive
return t != FlowTypeBackground
}

const (
Expand All @@ -44,7 +44,7 @@ const (

var flowTypeMapping = map[flows.FlowType]FlowType{
flows.FlowTypeMessaging: FlowTypeMessaging,
flows.FlowTypeMessagingPassive: FlowTypePassive,
flows.FlowTypeMessagingPassive: FlowTypeBackground,
flows.FlowTypeMessagingOffline: FlowTypeSurveyor,
flows.FlowTypeVoice: FlowTypeVoice,
}
Expand Down
6 changes: 3 additions & 3 deletions core/tasks/starts/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func TestStarts(t *testing.T) {

mr := &mailroom.Mailroom{Config: config.Mailroom, DB: db, RP: rp, ElasticClient: es}

// convert our single message flow to an actual passive flow that shouldn't interrupt
db.MustExec(`UPDATE flows_flow SET flow_type = 'P' WHERE id = $1`, models.SingleMessageFlowID)
// convert our single message flow to an actual background flow that shouldn't interrupt
db.MustExec(`UPDATE flows_flow SET flow_type = 'B' WHERE id = $1`, models.SingleMessageFlowID)

// insert a flow run for one of our contacts
// TODO: can be replaced with a normal flow start of another flow once we support flows with waits
Expand Down Expand Up @@ -236,7 +236,7 @@ func TestStarts(t *testing.T) {
expectedActiveRuns: map[models.FlowID]int{models.FavoritesFlowID: 123, models.PickNumberFlowID: 1, models.SingleMessageFlowID: 0},
},
{
label: "Passive flow",
label: "Background flow",
flowID: models.SingleMessageFlowID,
contactIDs: []models.ContactID{models.BobID},
includeActive: true,
Expand Down

0 comments on commit f7086c2

Please sign in to comment.