Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make streaming upload default true #5315

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions docs/companion.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ const options = {
allowLocalUrls: false,
logClientVersion: true,
periodicPingUrls: [],
streamingUpload: false,
streamingUpload: true,
clientSocketConnectTimeout: 60000,
metrics: true,
};
Expand Down Expand Up @@ -600,9 +600,7 @@ Prometheus metrics (by default metrics are enabled.)
A boolean flag to tell Companion whether to enable streaming uploads. If
enabled, it will lead to _faster uploads_ because companion will start uploading
at the same time as downloading using `stream.pipe`. If `false`, files will be
fully downloaded first, then uploaded. Defaults to `false`, but we recommended
enabling it, especially if you’re expecting to upload large files. In future
versions the default might change to `true`.
fully downloaded first, then uploaded. Defaults to `true`.

#### `maxFileSize` `COMPANION_MAX_FILE_SIZE`

Expand Down
2 changes: 2 additions & 0 deletions docs/guides/migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ These cover all the major Uppy versions and how to migrate to them.
- The URL endpoint (used by the `Url`/`Link` plugin) is now turned off by
default and must be explicitly enabled with
`COMPANION_ENABLE_URL_ENDPOINT=true` or `enableUrlEndpoint: true`.
- The option `streamingUpload` / `COMPANION_STREAMING_UPLOAD` now defaults to
`true`.
- The option `getKey(req, filename, metadata)` has changed signature to
`getKey({ filename, metadata, req })`.
- The option `bucket(req, metadata)` has changed signature to
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion/src/config/companion.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const defaultOptions = {
enableUrlEndpoint: false,
allowLocalUrls: false,
periodicPingUrls: [],
streamingUpload: false,
streamingUpload: true,
clientSocketConnectTimeout: 60000,
metrics: true,
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion/src/standalone/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const getConfigFromEnv = () => {
allowLocalUrls: process.env.COMPANION_ALLOW_LOCAL_URLS === 'true',
// cookieDomain is kind of a hack to support distributed systems. This should be improved but we never got so far.
cookieDomain: process.env.COMPANION_COOKIE_DOMAIN,
streamingUpload: process.env.COMPANION_STREAMING_UPLOAD === 'true',
streamingUpload: process.env.COMPANION_STREAMING_UPLOAD ? process.env.COMPANION_STREAMING_UPLOAD === 'true' : undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why true or undefined instead of true/false as before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we want it to default to true if the env variable is not set ( but it should still be possible to). if we return false here it will override the default which is true afaik

config gets merged here:

return merge({}, getConfigFromEnv(), getConfigFromFile(), options)

maxFileSize: process.env.COMPANION_MAX_FILE_SIZE ? parseInt(process.env.COMPANION_MAX_FILE_SIZE, 10) : undefined,
chunkSize: process.env.COMPANION_CHUNK_SIZE ? parseInt(process.env.COMPANION_CHUNK_SIZE, 10) : undefined,
clientSocketConnectTimeout: process.env.COMPANION_CLIENT_SOCKET_CONNECT_TIMEOUT
Expand Down