Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Synchronizing issues when several instances

See original GitHub issue

Does casbin support working in several application instances or does it provide an interface to implement such?


Let us say we have 2 instances of API: API 1 and API 2. Each of these instances have casbin enforcer inside the application. So, we have casbin 1 in API 1 and casbin 2 in API 2.

Each of them are looking in the same collection in database. But, considering the implementation of casbin, it stores permissions/roles in memory.

It leads to the problem that can be reproduced by the following scenario:

  • Developer grants a role to a user via API call to API 1.
  • API 1 does make changes in casbin 1 instance and adapter stores the changes in database
  • Though, API 2 and casbin 2 know nothing about recent change and use an out-of-date information from casbin 2 memory.

Any assumptions how it can be resolved?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

ghaiklorcommented, Dec 17, 2018

@hsluoyz I got a permission from our CTO to publish an adapter. The adapter I wrote fully tested and already being used in production. Though, we can do that somewhere in January, I need time for cleaning up the code, make required preparations for open-source it.

hsluoyzcommented, Dec 18, 2018

That’s good news! Thank you for your support on Casbin 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

On some synchronization problems with multiple instances
Many classical synchronization problems such as the assembly line crew scheduling problem (ALCS), some data association problems or ...
Read more >
Syncing between multiple instances of the same program
The best way to talk between two instances of the same application is use IPC. Bellow see example of class that can be...
Read more >
Multiple Instances without Synchronization - Workflow Patterns
Within a given process instance, multiple instances of a task can be created. These instances are independent of each other and run concurrently....
Read more >
How to synchronize two Jira instances without being ruined!
In this article, you will learn how to have two Jira instances synchronizing issues between each other using the "Integrations Hub for Jira" ......
Read more >
Synchronizing user configuration on multiple instances - Cleo
Collisions can occur if users on two synchronized systems both update an item at the same time. If the same item is updated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found