diff options
author | Nick White <git@njw.name> | 2021-07-13 10:34:26 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2021-07-13 10:34:26 +0100 |
commit | 05fbc6c65c8556d89d8b7fdb645f3ef3b273b5e9 (patch) | |
tree | ae1667fbb88de0792b589247cfb4e52adc989808 | |
parent | 02221d2268579a5858892617b9948ef6470551b5 (diff) |
aws: Only look up test queue id when asked for, as for most Init()s it won't be needed
-rw-r--r-- | aws.go | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -51,7 +51,6 @@ type AwsConn struct { downloader *s3manager.Downloader uploader *s3manager.Uploader wipequrl, prequrl, ocrpgqurl, analysequrl string - testqurl string wipstorageid string } @@ -126,15 +125,6 @@ func (a *AwsConn) Init() error { } a.analysequrl = *result.QueueUrl - a.Logger.Println("Getting test queue URL") - result, err = a.sqssvc.GetQueueUrl(&sqs.GetQueueUrlInput{ - QueueName: aws.String(queueTest), - }) - if err != nil { - return errors.New(fmt.Sprintf("Error getting test queue URL: %s", err)) - } - a.testqurl = *result.QueueUrl - return nil } @@ -347,7 +337,17 @@ func (a *AwsConn) WIPStorageId() string { } func (a *AwsConn) TestQueueId() string { - return a.testqurl + // We don't bother saving the queue id in Init(), as it's only + // used for testing + a.Logger.Println("Getting test queue URL") + result, err := a.sqssvc.GetQueueUrl(&sqs.GetQueueUrlInput{ + QueueName: aws.String(queueTest), + }) + if err != nil { + a.Logger.Printf("Error getting test queue URL: %s\n", err) + return "" + } + return *result.QueueUrl } func (a *AwsConn) ListObjects(bucket string, prefix string) ([]string, error) { |