Skip to content

Commit

Permalink
Covert MB to bytes for the API
Browse files Browse the repository at this point in the history
  • Loading branch information
cmackenzie1 committed Jan 8, 2025
1 parent def4db0 commit 65b67ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/wrangler/src/pipelines/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type PipelineUserConfig = {
};
batch: {
max_duration_s?: number;
max_mb?: number;
max_bytes?: number;
max_rows?: number;
};
path: {
Expand Down
7 changes: 5 additions & 2 deletions packages/wrangler/src/pipelines/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ export function pipelines(pipelineYargs: CommonYargsArgv) {
args.compression === undefined ? "gzip" : args.compression;

const batch = {
max_mb: args["batch-max-mb"],
max_bytes: args["batch-max-mb"]
? args["batch-max-mb"] * 1000 * 1000 // convert to bytes for the API
: undefined,
max_duration_s: args["batch-max-seconds"],
max_rows: args["batch-max-rows"],
};
Expand Down Expand Up @@ -386,7 +388,8 @@ export function pipelines(pipelineYargs: CommonYargsArgv) {
pipelineConfig.destination.compression.type = args.compression;
}
if (args["batch-max-mb"]) {
pipelineConfig.destination.batch.max_mb = args["batch-max-mb"];
pipelineConfig.destination.batch.max_bytes =
args["batch-max-mb"] * 1000 * 1000; // convert to bytes for the API
}
if (args["batch-max-seconds"]) {
pipelineConfig.destination.batch.max_duration_s =
Expand Down

0 comments on commit 65b67ce

Please sign in to comment.