Skip to content

Commit

Permalink
Make max number of steps configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jun 4, 2019
1 parent 634e642 commit 642503e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
22 changes: 12 additions & 10 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ type Config struct {

RetryPendingMessages bool `help:"whether to requeue pending messages older than five minutes to retry"`

MaxValueLength int `help:"the maximum size in characters for contact field values and run result values"`
MaxValueLength int `help:"the maximum size in characters for contact field values and run result values"`
MaxStepsPerSprint int `help:"the maximum number of steps allowed per engine sprint"`

LibratoUsername string `help:"the username that will be used to authenticate to Librato"`
LibratoToken string `help:"the token that will be used to authenticate to Librato"`
Expand All @@ -48,15 +49,16 @@ type Config struct {
// NewMailroomConfig returns a new default configuration object
func NewMailroomConfig() *Config {
return &Config{
DB: "postgres://temba:temba@localhost/temba?sslmode=disable",
DBPoolSize: 36,
Redis: "redis://localhost:6379/15",
BatchWorkers: 4,
HandlerWorkers: 32,
LogLevel: "error",
Version: "Dev",
SMTPServer: "",
MaxValueLength: 640,
DB: "postgres://temba:temba@localhost/temba?sslmode=disable",
DBPoolSize: 36,
Redis: "redis://localhost:6379/15",
BatchWorkers: 4,
HandlerWorkers: 32,
LogLevel: "error",
Version: "Dev",
SMTPServer: "",
MaxValueLength: 640,
MaxStepsPerSprint: 100,

S3Endpoint: "https://s3.amazonaws.com",
S3Region: "us-east-1",
Expand Down
5 changes: 4 additions & 1 deletion goflow/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import (
// Engine returns the global engine for use in mailroom
func Engine() flows.Engine {
engInit.Do(func() {
eng = engine.NewBuilder().WithDefaultUserAgent("RapidProMailroom/" + config.Mailroom.Version).Build()
eng = engine.NewBuilder().
WithDefaultUserAgent("RapidProMailroom/" + config.Mailroom.Version).
WithMaxStepsPerSprint(config.Mailroom.MaxStepsPerSprint).
Build()
})

return eng
Expand Down

0 comments on commit 642503e

Please sign in to comment.