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

Better timeouts #16

Merged
merged 1 commit into from
Apr 12, 2020
Merged

Better timeouts #16

merged 1 commit into from
Apr 12, 2020

Conversation

lucaong
Copy link
Owner

@lucaong lucaong commented Apr 6, 2020

Rather than setting arbitrary GenServer timeouts (which would crash the
caller but not stop the callee), enforce better timeouts that free up
resources when they elapse.

The Reader task is also greatly simplified, moving the responsibility to
check in/out readers in a single place in the CubDB module.

This commit introduces a breaking change to the public API, as both
select/2 and get_and_update_multi/4 now accept the timeout as an
option instead of a separate argument. This allows adding more options
in the future without having to change the number of arguments.

@lucaong lucaong changed the title better timeouts Better timeouts Apr 6, 2020
@lucaong lucaong force-pushed the better_timeouts branch 3 times, most recently from 9fe6698 to 5df3d3b Compare April 12, 2020 15:22
Rather than relying on the GenServer.call timeout, that exits the caller
but does not free up resources on the callee, this commit enforces the
timeout also on the callee side when performing reads.

Also `get_and_update_multi/4` now enforces a timeout on the callee side.

This commit also cleans up the public API around timeouts by introducing
a breaking change, as both `select/2` and `get_and_update_multi/4` now
accept the timeout as an option instead of a separate argument. This
allows to introduce more options in the future, without having to
introduce more breaking changes.

The reader check in and check out is also refactored to be substantially
simpler.
@lucaong lucaong merged commit da58d7c into master Apr 12, 2020
@lucaong lucaong deleted the better_timeouts branch April 12, 2020 18:28
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.

1 participant