Skip to content

Support context in lock #67

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

zacscoding
Copy link

@zacscoding zacscoding commented Sep 24, 2021

Support context parameters when acquiring a lock.

Hello, we want to cancel or receive timeout error when trying to acquire a lock.
So, I checked whether the context is done or not for each step.

I think it would be better if zk.Conn's functions are based on context such as Create(ctx context.Context, ...), but currently not supported :(

@nemith
Copy link

nemith commented Sep 28, 2021

I think this looks good, however I think locks should be in a different package and we should keep this around just for backwards compatibility until we can remove it in a v2 cut.

We should probably revisit https://github.com/go-zookeeper/recipes/issues/1 and #29

I am starting to think we should put these as sub packages to github.com/go-zookeeper/zk repository so we can avoid breakage between two different modules.

@codecov
Copy link

codecov bot commented Sep 28, 2021

Codecov Report

Merging #67 (377f917) into master (8866d76) will increase coverage by 0.42%.
The diff coverage is 45.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage   75.27%   75.69%   +0.42%     
==========================================
  Files           7        7              
  Lines        1189     1218      +29     
==========================================
+ Hits          895      922      +27     
- Misses        202      206       +4     
+ Partials       92       90       -2     
Impacted Files Coverage Δ
lock.go 60.00% <45.71%> (-3.39%) ⬇️
constants.go 75.00% <0.00%> (ø)
conn.go 73.46% <0.00%> (+1.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8866d76...377f917. Read the comment docs.

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.

2 participants