diff --git a/packages/wrangler/src/__tests__/queues.test.ts b/packages/wrangler/src/__tests__/queues.test.ts index 2fd6b9c52809..d1619afb0efc 100644 --- a/packages/wrangler/src/__tests__/queues.test.ts +++ b/packages/wrangler/src/__tests__/queues.test.ts @@ -102,6 +102,9 @@ describe("wrangler", () => { producers_total_count: 0, consumers: [], consumers_total_count: 0, + settings: { + delivery_delay: 0 + } }, { queue_id: "def19fa3787741579c9088eb850474af", @@ -112,6 +115,9 @@ describe("wrangler", () => { producers_total_count: 0, consumers: [], consumers_total_count: 0, + settings: { + delivery_delay: 0 + } }, ]; const expectedPage = 1; @@ -141,6 +147,9 @@ describe("wrangler", () => { producers_total_count: 0, consumers: [], consumers_total_count: 0, + settings: { + delivery_delay: 0 + } }, ]; const expectedPage = 2; @@ -216,8 +225,7 @@ describe("wrangler", () => { -v, --version Show version number [boolean] Options: - --no-delivery-delay Sets published messages to have no delay [boolean] - --delivery-delay How long a published messages should be delayed for, in seconds. Must be a positive integer [number]" + --delivery-delay How long a published messages should be delayed for, in seconds. Must be a positive integer [number]" `); }); @@ -280,22 +288,12 @@ describe("wrangler", () => { expect(requests.count).toEqual(1); }); - it("should send send queue settings with 0 delivery delay when noDeliveryDelay is set", async () => { - const requests = mockCreateRequest("testQueue", { delivery_delay: 0 }); - await runWrangler("queues create testQueue --no-delivery-delay"); - expect(std.out).toMatchInlineSnapshot(` - "Creating queue testQueue. - Created queue testQueue." - `); - expect(requests.count).toEqual(1); - }); - - it("should show an error with delivery delay and no delivery delay are used", async () => { + it("should show an error when two delivery delays are set", async () => { const requests = mockCreateRequest("testQueue", { delivery_delay: 0 }); await expect( runWrangler( - "queues create testQueue --no-delivery-delay --delivery-delay=10" + "queues create testQueue --delivery-delay=5 --delivery-delay=10" ) ).rejects.toThrowErrorMatchingInlineSnapshot( `"Error: can't use more than a delay setting."` @@ -436,8 +434,7 @@ describe("wrangler", () => { --message-retries Maximum number of retries for each message [number] --dead-letter-queue Queue to send messages that failed to be consumed [string] --max-concurrency The maximum number of concurrent consumer Worker invocations. Must be a positive integer [number] - --retry-delay How long a retried messages should be delayed for, in seconds. Must be a positive integer [number] - --no-retry-delay Sets retried messages have no delay. [boolean]" + --retry-delay How long a retried messages should be delayed for, in seconds. Must be a positive integer [number]" `); }); @@ -486,31 +483,7 @@ describe("wrangler", () => { `); }); - it("should add a consumer with no delay", async () => { - const expectedBody: PostConsumerBody = { - script_name: "testScript", - environment_name: "myEnv", - settings: { - batch_size: 20, - max_retries: 3, - max_wait_time_ms: 10 * 1000, - max_concurrency: 3, - retry_delay: 0, - }, - dead_letter_queue: "myDLQ", - }; - mockPostRequest("testQueue", expectedBody); - - await runWrangler( - "queues consumer add testQueue testScript --env myEnv --batch-size 20 --batch-timeout 10 --message-retries 3 --max-concurrency 3 --dead-letter-queue myDLQ --no-retry-delay" - ); - expect(std.out).toMatchInlineSnapshot(` - "Adding consumer to queue testQueue. - Added consumer to queue testQueue." - `); - }); - - it("should show an error with retry delay and no retry delay are used", async () => { + it("should show an error when two retry delays are set", async () => { const expectedBody: PostConsumerBody = { script_name: "testScript", environment_name: "myEnv", @@ -527,7 +500,7 @@ describe("wrangler", () => { await expect( runWrangler( - "queues consumer add testQueue testScript --env myEnv --batch-size 20 --batch-timeout 10 --message-retries 3 --max-concurrency 3 --dead-letter-queue myDLQ --no-retry-delay --retry-delay=10" + "queues consumer add testQueue testScript --env myEnv --batch-size 20 --batch-timeout 10 --message-retries 3 --max-concurrency 3 --dead-letter-queue myDLQ --retry-delay=5 --retry-delay=10" ) ).rejects.toThrowErrorMatchingInlineSnapshot( `"Error: can't use more than a delay setting."` diff --git a/packages/wrangler/src/queues/cli/commands/consumer/add.ts b/packages/wrangler/src/queues/cli/commands/consumer/add.ts index d16a82179201..4723f289aca0 100644 --- a/packages/wrangler/src/queues/cli/commands/consumer/add.ts +++ b/packages/wrangler/src/queues/cli/commands/consumer/add.ts @@ -45,14 +45,8 @@ export function options(yargs: CommonYargsArgv) { type: "number", describe: "How long a retried messages should be delayed for, in seconds. Must be a positive integer", number: true, - }, - "no-retry-delay": { - type: "boolean", - describe: "Sets retried messages have no delay.", - boolean: true - }, - }) - .conflicts('retry-delay', 'no-retry-delay') + } + }); } function createBody(args: StrictYargsOptionsToInterface): PostConsumerBody { diff --git a/packages/wrangler/src/queues/cli/commands/create.ts b/packages/wrangler/src/queues/cli/commands/create.ts index 234d88b9de6b..792aaed45b26 100644 --- a/packages/wrangler/src/queues/cli/commands/create.ts +++ b/packages/wrangler/src/queues/cli/commands/create.ts @@ -17,17 +17,11 @@ export function options(yargs: CommonYargsArgv) { description: "The name of the queue", }) .options({ - "no-delivery-delay": { - type: "boolean", - describe: "Sets published messages to have no delay", - boolean: true, - }, "delivery-delay": { type: "number", describe: "How long a published messages should be delayed for, in seconds. Must be a positive integer", } - }) - .conflicts('delivery-delay', 'no-delivery-delay') + }); } function createBody(args: StrictYargsOptionsToInterface): CreateQueueBody { diff --git a/packages/wrangler/src/queues/cli/commands/index.ts b/packages/wrangler/src/queues/cli/commands/index.ts index 25ca6284b2a8..0ebb7f082298 100644 --- a/packages/wrangler/src/queues/cli/commands/index.ts +++ b/packages/wrangler/src/queues/cli/commands/index.ts @@ -4,7 +4,6 @@ import { handler as createHandler, options as createOptions } from "./create"; import { handler as deleteHandler, options as deleteOptions } from "./delete"; import { handler as listHandler, options as listOptions } from "./list"; import type { CommonYargsArgv } from "../../../yargs-types"; -import { CommandLineArgsError, printWranglerBanner } from "../../../index"; export function queues(yargs: CommonYargsArgv) { yargs.command("list", "List Queues", listOptions, listHandler);