Release of RC1 #7

Merged
abelhooge merged 34 commits from 3-features into master 2020-06-07 13:54:20 +00:00
2 changed files with 7 additions and 9 deletions
Showing only changes of commit db08da8213 - Show all commits

View File

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

View File

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