Skip to content

Commit

Permalink
fix: use docker client without timeout for copy files operation (#2565)
Browse files Browse the repository at this point in the history
## Description
If the a user tries to do `store_service_files` on a large directory,
they will receive a timeout. To fix this, use the docker client with no
timeout when copying files from service container.

## Is this change user facing?
NO
  • Loading branch information
tedim52 authored Oct 15, 2024
1 parent f1da132 commit a48ed55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func CopyFilesFromUserService(
output io.Writer,
dockerManager *docker_manager.DockerManager,
) error {

srcPath := srcPathOnContainer
srcPathBase := filepath.Base(srcPathOnContainer)
if srcPathBase == doNotIncludeParentDirInArchiveSymbol {
Expand Down Expand Up @@ -54,10 +53,11 @@ func CopyFilesFromUserService(
}
defer tarStreamReadCloser.Close()

if _, err := io.Copy(output, tarStreamReadCloser); err != nil {
if numBytesCopied, err := io.Copy(output, tarStreamReadCloser); err != nil {
return stacktrace.Propagate(
err,
"An error occurred copying the bytes of TAR'd up files at '%v' on service '%v' to the output",
"'%v' bytes copied before an error occurred copying the bytes of TAR'd up files at '%v' on service '%v' to the output",
numBytesCopied,
srcPathOnContainer,
serviceUuid,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ func (manager *DockerManager) CopyFromContainer(ctx context.Context, containerId
}
}

tarStreamReadCloser, _, err := manager.dockerClient.CopyFromContainer(
tarStreamReadCloser, _, err := manager.dockerClientNoTimeout.CopyFromContainer(
ctx,
containerId,
srcPath)
Expand Down

0 comments on commit a48ed55

Please sign in to comment.