Skip to content
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

Added support for FIFO flatfile driver #386

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evilfer
Copy link

@evilfer evilfer commented Jul 4, 2018

This PR adds a third constructor param to FlatFileDriver:

public function __construct($baseDirectory, $permissions = 0740, $options = null)

There is one option supported:

$options = [
  'queueType' => 'lifo' // possible values: 'lifo', 'fifo'; default: 'lifo' (no breaking changes)
];

When queue type is FIFO, the behaviour of popMessage and peekQueue is modified.
See \Tests\Driver\FlatFile\FifoDriverTest.php for tests running with FIFO config.

@@ -158,7 +161,9 @@ public function peekQueue($queueName, $index = 0, $limit = 20)
$files = array_keys(iterator_to_array($it));

natsort($files);
$files = array_reverse($files);
if ($this->queueType === 'life') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, not sure why all tests pass with it :(

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there is no specific test for the new fifo/lifo functionality?
(i created a pull request with fix and tests against your branch)

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.

3 participants