-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Concurrency issues with custom adapter #323
Comments
@hsluoyz thanks, will try it out. |
Ok, I've been testing for a few minutes and this doesn't seem to work. It still failed after about 100 requests.
|
Change: functions := e.fm into: var functions model.FunctionMap
for k, v := range e.fm {
functions[k] = v
} See if it fixed. |
Do you mean clone the lib and change that line? |
Can you apply these lines into your source code as a hot fix to see it solves the issue? If yes, I will push it to master. Where your source code is depends on whether you use GOPATH or Go modules. |
I've been testing it for the past 30 mins and it seems to be stable with the change you suggested. I could make a PR with the fix. |
Please do it. |
fix: fix function mapping in concurrent envs and close #323
@hsluoyz when do you plan to make a release? |
Released v2.1.1: https://github.com/casbin/casbin/releases/tag/v2.1.1 |
I'm not exactly sure if it's because of the custom adapter I use, but I keep getting:
So it fails around
functions[key] = util.GenerateGFunction(rm)
.Here's the custom adapter I use:
And the middleware I use with echo:
And the way I init and use it:
The text was updated successfully, but these errors were encountered: