casbin / gorm-adapter

GORM adapter for Casbin, see extended version of GORM Adapter Ex at: https://github.com/casbin/gorm-adapter-ex
https://github.com/casbin/casbin
Apache License 2.0
692 stars 206 forks source link

feat: initialize transactionMu in NewAdapterByDBUseTableName #237

Closed yuikns closed 5 months ago

yuikns commented 5 months ago

constructor NewAdapterByDBUseTableName should initialize transactionMu, otherwise it will panic blocked due to that CAS when calling Transaction

Besides, a few other constructors also depend on NewAdapterByDBUseTableName, if transactionMu is not initialized in NewAdapterByDBUseTableName, it will blocked as well.

Besides, why not consider use sync.Once to initialize transactionMu?

CLAassistant commented 5 months ago

CLA assistant check
All committers have signed the CLA.

yuikns commented 5 months ago

pretty similar to #236

actually i just hoping to initialize that transactionMu asap, otherwise my current code will totally blocked in that CAS loop...

github-actions[bot] commented 5 months ago

:tada: This PR is included in version 3.25.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: