Skip to content

Commit

Permalink
Fix IVR for orgs using S3 sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Sep 9, 2021
1 parent 0b67cac commit 49a7976
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion mailroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (mr *Mailroom) Start() error {
mr.handlerForeman.Start()

// start our web server
mr.webserver = web.NewServer(mr.ctx, c, mr.rt.DB, mr.rt.RP, mr.rt.MediaStorage, mr.rt.ES, mr.wg)
mr.webserver = web.NewServer(mr.ctx, c, mr.rt.DB, mr.rt.RP, mr.rt.MediaStorage, mr.rt.SessionStorage, mr.rt.ES, mr.wg)
mr.webserver.Start()

logrus.WithField("domain", c.Domain).Info("mailroom started")
Expand Down
2 changes: 1 addition & 1 deletion web/contact/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestSearch(t *testing.T) {
)
assert.NoError(t, err)

server := web.NewServer(ctx, config.Mailroom, db, rp, nil, client, wg)
server := web.NewServer(ctx, config.Mailroom, db, rp, nil, nil, client, wg)
server.Start()

// give our server time to start
Expand Down
4 changes: 2 additions & 2 deletions web/ivr/ivr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestTwilioIVR(t *testing.T) {
twiml.IgnoreSignatures = true

wg := &sync.WaitGroup{}
server := web.NewServer(ctx, config.Mailroom, db, rp, testsuite.MediaStorage(), nil, wg)
server := web.NewServer(ctx, config.Mailroom, db, rp, testsuite.MediaStorage(), testsuite.SessionStorage(), nil, wg)
server.Start()
defer server.Stop()

Expand Down Expand Up @@ -399,7 +399,7 @@ func TestVonageIVR(t *testing.T) {
defer ts.Close()

wg := &sync.WaitGroup{}
server := web.NewServer(ctx, config.Mailroom, db, rp, testsuite.MediaStorage(), nil, wg)
server := web.NewServer(ctx, config.Mailroom, db, rp, testsuite.MediaStorage(), testsuite.SessionStorage(), nil, wg)
server.Start()
defer server.Stop()

Expand Down
2 changes: 1 addition & 1 deletion web/org/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestMetrics(t *testing.T) {
db.MustExec(`INSERT INTO api_apitoken(is_active, org_id, created, key, role_id, user_id) VALUES(TRUE, $1, NOW(), $2, 8, 1);`, testdata.Org1.ID, adminToken)

wg := &sync.WaitGroup{}
server := web.NewServer(ctx, config.Mailroom, db, rp, nil, nil, wg)
server := web.NewServer(ctx, config.Mailroom, db, rp, nil, nil, nil, wg)
server.Start()

// wait for the server to start
Expand Down
13 changes: 7 additions & 6 deletions web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@ func RegisterRoute(method string, pattern string, handler Handler) {
}

// NewServer creates a new web server, it will need to be started after being created
func NewServer(ctx context.Context, config *config.Config, db *sqlx.DB, rp *redis.Pool, store storage.Storage, es *elastic.Client, wg *sync.WaitGroup) *Server {
func NewServer(ctx context.Context, config *config.Config, db *sqlx.DB, rp *redis.Pool, mediaStorage storage.Storage, sessionStorage storage.Storage, es *elastic.Client, wg *sync.WaitGroup) *Server {
s := &Server{
ctx: ctx,
rt: &runtime.Runtime{
RP: rp,
DB: db,
ES: es,
MediaStorage: store,
Config: config,
RP: rp,
DB: db,
ES: es,
MediaStorage: mediaStorage,
SessionStorage: sessionStorage,
Config: config,
},

wg: wg,
Expand Down
2 changes: 1 addition & 1 deletion web/simulation/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func TestServer(t *testing.T) {

wg := &sync.WaitGroup{}

server := web.NewServer(ctx, config.Mailroom, db, rp, nil, nil, wg)
server := web.NewServer(ctx, config.Mailroom, db, rp, nil, nil, nil, wg)
server.Start()

// give our server time to start
Expand Down
2 changes: 1 addition & 1 deletion web/surveyor/surveyor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestSurveyor(t *testing.T) {
defer rc.Close()

wg := &sync.WaitGroup{}
server := web.NewServer(ctx, config.Mailroom, db, rp, nil, nil, wg)
server := web.NewServer(ctx, config.Mailroom, db, rp, nil, nil, nil, wg)
server.Start()
defer server.Stop()

Expand Down
2 changes: 1 addition & 1 deletion web/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func RunWebTests(t *testing.T, truthFile string, substitutions map[string]string

defer testsuite.ResetStorage()

server := NewServer(context.Background(), config.Mailroom, db, rp, testsuite.MediaStorage(), nil, wg)
server := NewServer(context.Background(), config.Mailroom, db, rp, testsuite.MediaStorage(), testsuite.SessionStorage(), nil, wg)
server.Start()
defer server.Stop()

Expand Down

0 comments on commit 49a7976

Please sign in to comment.