Skip to content

Commit

Permalink
S3OutputStream: cap maximum local cache to respect MAX_UPLOAD_PART_SIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Marstaller committed Dec 10, 2018
1 parent 664e60d commit a60647b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/kotlin/com/hubject/aws/s3/io/S3OutputStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ class S3OutputStream(
* The actual amount of local cache; this caps the requested [maxLocalCache] to what
* the [ByteBuffer]s can hold (2GiB each).
*/
val actualLocalCache: Long = Math.min(Int.MAX_VALUE.toLong() * 2, maxLocalCache)
val actualLocalCache: Long = Math.min(
Int.MAX_VALUE.toLong() * 2,
Math.min(
maxLocalCache,
MAX_UPLOAD_PART_SIZE * 2
)
)

/**
* Nullable so that it can be released on [close]
Expand Down

0 comments on commit a60647b

Please sign in to comment.