Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws: reuse session and S3 manager #1639

Merged
merged 1 commit into from
Jan 28, 2024

Conversation

mauri870
Copy link
Contributor

@mauri870 mauri870 commented Jan 28, 2024

The AWS session and s3 manager are concurrent safe, they should be reused whenever possible:

Sessions are safe to use concurrently as long as the Session is not
being modified. Sessions should be cached when possible, because
creating a new Session will load all configuration values from the
environment, and config files each time the Session is created.

See https://pkg.go.dev/github.com/aws/aws-sdk-go/aws/session

Currently, an aws session and s3 client/manager are created every time a call to Upload, CurrentID or Download is made. I changed it so it creates one session and S3 manager during app startup and reuse it afterwards.

The AWS session and s3 manager are concurrent safe, it should be reused
whenever possible:

    Sessions are safe to use concurrently as long as the Session is not
    being modified. Sessions should be cached when possible, because
    creating a new Session will load all configuration values from the
    environment, and config files each time the Session is created.

See https://pkg.go.dev/github.com/aws/aws-sdk-go/aws/session

Currently, an aws session and s3 client/manager are created every time a
call to Upload, CurrentID or Download is made. I changed it so it creates
one session and S3 manager during app startup and reuse it afterwards.
@otoolep
Copy link
Member

otoolep commented Jan 28, 2024

Thanks for your contribution, looks good.

@otoolep otoolep merged commit ec9934d into rqlite:master Jan 28, 2024
18 checks passed
otoolep added a commit that referenced this pull request Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants