3

I use Amazonica to download an object from S3:

(require '[amazonica.aws.s3 :as s3])

(s3/get-object "my-bucket" "foo")

However, sometimes the download hangs. How can I set a timeout?

Vebjorn Ljosa
  • 17,438
  • 13
  • 70
  • 88

1 Answers1

6

s3/get-object can also take keyword arguments:

(require '[amazonica.aws.s3 :as s3])

(s3/get-object :bucket-name "my-bucket" :key "foo")

You can add additional keyword arguments for any accessors on GetObjectRequest. In this case, you want the method SdkClientExecutionTimeout to be called, so do this:

(s3/get-object :bucket-name "my-bucket" :key "foo"
               :sdk-client-execution-timeout 10000)
Vebjorn Ljosa
  • 17,438
  • 13
  • 70
  • 88