Skip to content

Add options to JobOpts and skip Redis AUTH if password is empty #2

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 6 additions & 3 deletions src/Clients/PhpRedisQueue.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types=1);
declare (strict_types = 1);

namespace Ilzrv\PhpBullQueue\Clients;

Expand All @@ -13,13 +13,16 @@ class PhpRedisQueue implements RedisQueue

public function __construct(RedisConfig $config, Redis $redis = null)
{
if (!is_null($redis)) {
if (! is_null($redis)) {
$this->client = $redis;
} else {
$this->client = new Redis();

$this->client->connect($config->host, $config->port);
$this->client->auth($config->password);
if ($config->password) {
$this->client->auth($config->password);
}
$this->client->select($config->db);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/DTOs/JobOpts.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ class JobOpts extends DataTransferObject
public int $attempts = 1;
public int $timestamp;
public int $delay = 0;
public bool $removeOnComplete = false;
public bool $removeOnFail = false;
}