@@ -23,7 +23,6 @@ type s3Driver struct {
2323 s3client S3Client
2424 config * Config
2525 migrations * source.Migrations
26- ctx context.Context
2726}
2827
2928type Config struct {
@@ -56,10 +55,9 @@ func WithInstance(ctx context.Context, s3client S3Client, config *Config) (sourc
5655 config : config ,
5756 s3client : s3client ,
5857 migrations : source .NewMigrations (),
59- ctx : ctx ,
6058 }
6159
62- if err := driver .loadMigrations (); err != nil {
60+ if err := driver .loadMigrations (ctx ); err != nil {
6361 return nil , err
6462 }
6563
@@ -83,8 +81,8 @@ func parseURI(uri string) (*Config, error) {
8381 }, nil
8482}
8583
86- func (s * s3Driver ) loadMigrations () error {
87- output , err := s .s3client .ListObjects (s . ctx , & s3.ListObjectsInput {
84+ func (s * s3Driver ) loadMigrations (ctx context. Context ) error {
85+ output , err := s .s3client .ListObjects (ctx , & s3.ListObjectsInput {
8886 Bucket : aws .String (s .config .Bucket ),
8987 Prefix : aws .String (s .config .Prefix ),
9088 Delimiter : aws .String ("/" ),
@@ -152,7 +150,8 @@ func (s *s3Driver) ReadDown(version uint) (io.ReadCloser, string, error) {
152150
153151func (s * s3Driver ) open (m * source.Migration ) (io.ReadCloser , string , error ) {
154152 key := path .Join (s .config .Prefix , m .Raw )
155- object , err := s .s3client .GetObject (s .ctx , & s3.GetObjectInput {
153+ ctx := context .Background ()
154+ object , err := s .s3client .GetObject (ctx , & s3.GetObjectInput {
156155 Bucket : aws .String (s .config .Bucket ),
157156 Key : aws .String (key ),
158157 })
0 commit comments