Now try while flushing a selected database.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Abel Hoogeveen 2020-05-26 13:53:10 +02:00
parent 18d702ec26
commit db08da8213
No known key found for this signature in database
GPG Key ID: 96C2234920BF4292
2 changed files with 7 additions and 9 deletions

View File

@ -80,6 +80,9 @@ class RedisTaskStorage implements TaskStorage
// Otherwise attempt authentication, if needed
if (isset($parameters['password']) && !$this->conn->auth($parameters['password']))
throw new TasksException("Could not construct RedisTaskStorage. Authentication failure.");
// And select the DB index
$this->conn->select($parameters['db_index']);
} catch (RedisException $e) {
throw new TasksException("Could not construct RedisTaskStorage. RedisException thrown: '" . $e->getMessage() . "'");
}
@ -282,7 +285,7 @@ class RedisTaskStorage implements TaskStorage
{
// First get the task ID
$taskId = $task->getId();
// Check if the key already exists
if (!$this->conn->exists($this->key_prefix . $taskId . '_post_' . $attempt))
return null;
@ -296,16 +299,10 @@ class RedisTaskStorage implements TaskStorage
/**
* @inheritDoc
* @throws TasksException
*/
public function reset(): bool
{
// First get a list of all tasks
foreach ($this->readTasks() as $task)
$this->deleteTask($task);
$this->refreshTasks();
return true;
// Clear the current db
return $this->conn->flushDB();
}
}

View File

@ -68,6 +68,7 @@ return array(
'password' => Core::getEnv('TASKSTORAGE_REDIS_PASSWORD', null),
'port' => Core::getEnv('TASKSTORAGE_REDIS_PORT', 6379),
'timeout' => Core::getEnv('TASKSTORAGE_REDIS_TIMEOUT', 0),
'db_index' => Core::getEnv('TASKSTORAGE_REDIS_DBINDEX', 0),
]
],
'Executor' => [