-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5cf4cad
commit 4031bfb
Showing
2 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4031bfb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presenting ConcurrentUser
ConcurrentUser is a new extension to prevent ConcurrencyExceptions.
It's a widget based in SignalR that appears when the two or more users are viewing/modifying the same entity at the same time.
Let's see how it works:
Without local changes
When two users open the same entity the widget appears with a green icon, and on clicking a Popover shows the current status:
If the other user starts making local changes, the icon becomes yellow and an icon shows that the user has started modifying the entity:
Once the other saves the changes to the database the icon becomes red and a MessageModal appears:
If you choose not to reload, you can always do it again by clicking in the Popover
With local changes
If you have local changes the icon stats blincking intermitently and the Popover shows some extra message.
If the other user starts making changes too, looks like this:
And if the other user overtakes you and saves, then the MessageModal shows a warning and suggests to re-apply the changes over the new version of the entity in another tab (to copy-paste your changes).
If you dismiss the MessageModal, you can still see the suggestion in the Popover
How it works
There is a new
ConcurrentUserEntity
that is saved in the database to keep track of the current opened entities by user and SignalR ConnectionId.When the entity is closed, the
ConcurrentUserEntity
is deleted. Since SignalR uses persistent connections, even closing the tab will delete theConcurrentUserEntity
, but when you stop the server (debugging, or deployment) zombieConcurrentUserEntity
could be seen.You can manually delete them for now with the delete operation. Maybe in the future we will make a better solution (ScheduledTask / Delete on start).
SignalR limitations in IIS for Windows Clients
IIS imposes a limit of 10 simultaneous connections on Windows Client machines (Windows 10, Windows 11, etc...)
https://docs.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-3.1#iis-limitations-on-windows-client-os
In practice this means that when debugging in IIS, if you open more than 3 tabs the server becomes unresponsive untill you close one tab:
To prevent this from happening we disable SignalR on Debug mode in IIS.
Use IIS Express to debug this feature.
How to activate it
ConcurrentUser is already part of Southwind and checked by default for new applications.
You can activate it in your current app by applying the changes in
Starter.cs
,Startup.cs
,MainAdmin.cs
, andIndex.cshtml
from this commit:signumsoftware/southwind@66e0909
Thanks @JafarMirzaie!