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

Add a cap on total queue files #20

Merged
merged 2 commits into from
Feb 20, 2018
Merged

Add a cap on total queue files #20

merged 2 commits into from
Feb 20, 2018

Conversation

blt
Copy link
Collaborator

@blt blt commented Feb 17, 2018

This commit adds a max_disk_files option to channel_with_explicit_capacity that allows the caller to set the total amount of on-disk consumption. The caller may choose to loop on a send which results in hopper::Error::Full or drop the data and try again later. Hopper will not block sends when there is no space available -- in memory or disk -- to store the item.

This work is done in the service of supporting postmates/cernan#411 and postmates/cernan#412.

Signed-off-by: Brian L. Troutwine [email protected]

This commit adds a `max_disk_files` option to `channel_with_explicit_capacity`
that allows the caller to set the total amount of on-disk consumption.
The caller may choose to loop on a send which results in
`hopper::Error::Full` or drop the data and try again later. Hopper
will _not_ block sends when there is no space available -- in memory
or disk -- to store the item.

This work is done in the service of supporting
postmates/cernan#411 and
postmates/cernan#412.

Signed-off-by: Brian L. Troutwine <[email protected]>
@blt blt requested review from dparton and ekimekim February 17, 2018 02:21
Copy link

@ekimekim ekimekim left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, though I'll wait for someone with a bit more Hopper and Rust experience to approve.

Copy link
Contributor

@tsantero tsantero left a comment

Choose a reason for hiding this comment

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

minor documentation change requested, otherwise lgtm

README.md Outdated

`hopper::channel_with_max_bytes` takes a `max_disk_files` argument, defining the
total number of overflow files that can exist concurrently. If all memory and
disk buffers are full sends into the queue will fail but the error result is
Copy link
Contributor

Choose a reason for hiding this comment

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

the sentence beginning If all memory... is difficult to read. the verbal noun sends can be confusing. i'd also strongly recommend breaking the error result subordinate clause into it's own sentence.

Choose a reason for hiding this comment

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

how about are full, sends into the queue fill fail. However, the error result is implemented such that the caller...
This clarifies the noun-ness of sends by explicitly breaking the if clause into predicate and effect, and avoids the word "written" which can be ambiguous when used to mean 'how the code is written' while talking about a system that writes to disk.

The language in the README was a touch confusing. If it's still
confusing it's no longer confusing in the same way.

Signed-off-by: Brian L. Troutwine <[email protected]>
@blt blt merged commit aa6e1d0 into master Feb 20, 2018
@blt blt deleted the ingress_shedding branch February 20, 2018 18:39
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