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

Validate queue options and exit if option is not acceptable #5

Open
silviucpp opened this issue Sep 6, 2017 · 5 comments
Open

Validate queue options and exit if option is not acceptable #5

silviucpp opened this issue Sep 6, 2017 · 5 comments

Comments

@silviucpp
Copy link

Hello,

Having the following queue:

{ok, Q}= esq:new( "priv/client_producer", [{tts, 0}, {capacity, 0}]).

After I add few items inside the queue and restart the app and do:

esq:head(Q).

I always receive undefined but esq:deq always returns items. I'm expecting head to return same stuff as deq but without removing the item from queue.

I'm using [{tts, 0}, {capacity, 0}] to make sure all items are going on the disk directly. I'm wrong ?

Silviu

@fogfish
Copy link
Owner

fogfish commented Sep 6, 2017

I'll check it... but please keep in mind that tts is queue time-to-sync (rotate) file segments in milliseconds. I would not keep it equal to 0.

@silviucpp
Copy link
Author

ohh ok :) thanks

@fogfish
Copy link
Owner

fogfish commented Sep 6, 2017

Right, I've checked your case deeply. Actually, 0 is not valid value for tts and capacity. The capacity defines the size of in-memory queue. The queue would not fetch anything from disk into memory buffer if capacity is 0. You should not afraid to put capacity > 0. The queue always writes data to disk during enqueue.

@fogfish fogfish changed the title odd behaviour Validate queue options and exit if option is not acceptable Sep 6, 2017
@fogfish
Copy link
Owner

fogfish commented Sep 6, 2017

I would do the following improvements

  • Update README.md. The following statement is not valid: 'Queue starts to "swap" to file segments only when enqueue rate causes an overflow of in-memory buffer.'
  • Accept capacity only if it is > 0
  • Accept tts only if it is > 0

@fogfish fogfish added the bug label Sep 6, 2017
@silviucpp
Copy link
Author

@fogfish you can also add documentation for capacity in the readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants