Skip to content

Multiple calls to parameter store in single function #24

Description

@billglover

The msgFlagger function makes multiple calls to the AWS parameter store to retrieve the same information.

The first call during func getAdminChannel(string) (string, error):

bbot/cmd/msgFlagger/main.go

Lines 219 to 222 in a2f193b

ar, err := secrets.GetTeamTokens(&db, t)
if err != nil {
return adminChan, errors.Wrap(err, "unable to fetch team tokens")
}

The second call during func getUserName(string, string) (string, error):

bbot/cmd/msgFlagger/main.go

Lines 247 to 250 in a2f193b

ar, err := secrets.GetTeamTokens(&db, t)
if err != nil {
return userName, errors.Wrap(err, "unable to fetch team tokens")
}

As both of these are remote calls they incur unnecessary cost. An optimisation could be to make a single call and then pass the required values as parameters to these functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions