-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop large archive downloads timing out (#3925)
* don't timeout when making archive of many large remote files * re-implement sorting for archives * ignore long-running test * scalafmt * don't use lazy source * renames / tidy up * log error message * scalafmt * remove println * fix compile error * increase patience on TarDownloadSpec * scalafmt
- Loading branch information
1 parent
cbabe96
commit 029c727
Showing
11 changed files
with
291 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 37 additions & 8 deletions
45
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/directives/FileResponse.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
package ch.epfl.bluebrain.nexus.delta.sdk.directives | ||
|
||
import akka.http.scaladsl.model.ContentType | ||
import ch.epfl.bluebrain.nexus.delta.sdk.AkkaSource | ||
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.encoder.JsonLdEncoder | ||
import ch.epfl.bluebrain.nexus.delta.sdk.directives.FileResponse.{Content, Metadata} | ||
import ch.epfl.bluebrain.nexus.delta.sdk.{AkkaSource, JsonLdValue} | ||
import ch.epfl.bluebrain.nexus.delta.sdk.directives.Response.Complete | ||
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.HttpResponseFields | ||
import monix.bio.IO | ||
|
||
/** | ||
* A file response content | ||
* | ||
* @param filename | ||
* the filename | ||
* @param contentType | ||
* the file content type | ||
* @param bytes | ||
* the file size | ||
* @param metadata | ||
* the file metadata | ||
* @param content | ||
* the file content | ||
*/ | ||
final case class FileResponse(filename: String, contentType: ContentType, bytes: Long, content: AkkaSource) | ||
final case class FileResponse(metadata: Metadata, content: Content) | ||
|
||
object FileResponse { | ||
|
||
type Content = IO[Complete[JsonLdValue], AkkaSource] | ||
|
||
/** | ||
* Metadata for the file response | ||
* | ||
* @param filename | ||
* the filename | ||
* @param contentType | ||
* the file content type | ||
* @param bytes | ||
* the file size | ||
*/ | ||
final case class Metadata(filename: String, contentType: ContentType, bytes: Long) | ||
|
||
def apply[E: JsonLdEncoder: HttpResponseFields]( | ||
filename: String, | ||
contentType: ContentType, | ||
bytes: Long, | ||
io: IO[E, AkkaSource] | ||
) = | ||
new FileResponse(Metadata(filename, contentType, bytes), io.mapError { e => Complete(e).map(JsonLdValue(_)) }) | ||
|
||
def apply(filename: String, contentType: ContentType, bytes: Long, source: AkkaSource): FileResponse = | ||
new FileResponse(Metadata(filename, contentType, bytes), IO.pure(source)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.