Takes context as a parameter but doesn't do anything with it
ciokan opened this issue · 5 comments
Looks like a false trap that context that Take
takes as a parameter.
Nevermind, I see that Take
does not wait at all so the ctx is useless in this case.
@ciokan the limiter defines an interface; it's possible that "Taking" could need to be cancelled. For example, https://github.com/sethvargo/go-redisstore communicates with redis and therefore is cancellable.
True. I thought Take
waits until it can "give" as in other packages and I was looking for a way to stop it with a context in case it waits too much but your implementation does not wait so it's all good.
Ah - yes. Take
immediately returns. The boolean returned indicates whether the take was successful. This is documented in the godoc: https://github.com/sethvargo/go-limiter/blob/main/store.go#L34-L35
This issue has been automatically locked since there has not been any
recent activity after it was closed. Please open a new issue for
related bugs.