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

Make poll loops in DB and filesystem drivers more configurable #136

Open
jmikola opened this issue Dec 19, 2014 · 4 comments
Open

Make poll loops in DB and filesystem drivers more configurable #136

jmikola opened this issue Dec 19, 2014 · 4 comments

Comments

@jmikola
Copy link
Contributor

jmikola commented Dec 19, 2014

See #133 (comment) for context.

As-is, it seems impossible to simply poll the queue without blocking. This is noticed in some tests where we call popMessage() on an empty queue and effectively slam the database for five seconds.

Ideally, I'd like to be able to specify zero as my $interval to do a single query. This would require changing the while loop to a do while. Thoughts?

Per discussion with @henrikbjorn, other drivers (not database and filesystem) do block on popMessage() since many of those services bill by request. For database and filesystem drivers, having $interval default to zero would allow users to handle polling on their own (outside of the driver).

Suggestion is to refactor while to do while, which will support an $interval of zero and allow for a single poll. Additionally, the database and filesystem sleeps should probably be made consistent.

@jmikola jmikola changed the title Make poll loops in database and filesystem drivers more configurable Make poll loops in DB and filesystem drivers more configurable Dec 19, 2014
@jmikola
Copy link
Contributor Author

jmikola commented Dec 19, 2014

@henrikbjorn: Feel free to assign this to me.

@henrikbjorn
Copy link
Contributor

The only real solution i could come up with, https://gist.github.com/henrikbjorn/13ab6a8923f7c17f1615 what do you think?

@jmikola
Copy link
Contributor Author

jmikola commented Jan 12, 2015

@henrikbjorn: That looks like that I had in mind. Is a static utility function really necessary, though?

@henrikbjorn
Copy link
Contributor

it could be an ordinary function maybe

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

No branches or pull requests

2 participants