tispratik opened a new pull request, #64:
URL: https://github.com/apache/casbin-ex/pull/64

   The casbin_rule table has a unique index casbin_rule_content_unique on 
(ptype, v0..v6) NULLS NOT DISTINCT. A bare repo.insert raises 
Ecto.ConstraintError when a duplicate rule is inserted — e.g. two nodes racing 
after an EnforcerServer restart, or in-memory and DB state diverging. That 
exception propagates out of handle_call and crashes the EnforcerServer 
GenServer, a critical process that is slow to recover.
   
   Patched add_policy/2 and insert_policy/3 (used by save_policies/2) to use 
on_conflict: :nothing, which silently skips the duplicate and returns {:ok, 
struct}. No data is lost — the rule already exists in the DB.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to