Skip to content

Update QueueWorkCommand.php - #6

Merged
mychidarko merged 1 commit into
leafsphp:v5.xfrom
BadrtSoft:v5.x
Oct 27, 2026
Merged

mychidarko merged 1 commit into
leafsphp:v5.xfrom
BadrtSoft:v5.x

Conversation

@BadrtSoft

Copy link
Copy Markdown
Contributor
## Bug description

`leaf queue:work` ignores the configured default queue when the optional `--queue` option is omitted. It reports:

> No queue specified and no default queue configured. Set `default` in your queue config or pass --queue.

The application has a valid default queue configured, and `MvcConfig('queue')` returns it correctly.

## Steps to reproduce

1. Configure a default queue:

   ```php
   return [
       'default' => 'database',
       'connections' => [
           'database' => [
               'driver' => 'database',
               // ...
           ],
       ],
   ];
  1. Run:

    leaf queue:work
  2. The command reports that no queue is configured instead of using database.

Expected behavior

When --queue is omitted, the worker should use the default value from the queue configuration.

Actual behavior

The worker reports that no queue is configured, even though MvcConfig('queue')['default'] contains database.

Proposed solution

In QueueWorkCommand::resolveQueueConnection(), treat an empty option like an omitted option when selecting the queue:

$queue = $option ?: ($config['default'] ?? null);

This allows the configured default to be used when Sprout returns an empty string for the missing optional --queue option. Explicit queue names continue to take precedence.

Environment

  • leafs/queue: v5.0
  • leafs/sprout: v5
  • PHP: 8.2+
  • Queue driver: database

@mychidarko
mychidarko merged commit 14b6d01 into leafsphp:v5.x Oct 27, 2026
4 checks passed
@mychidarko

Copy link
Copy Markdown
Member

Thanks for this @BadrtSoft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants