Fixes #39083 - Use Action Cable for UI notifications#10866
Fixes #39083 - Use Action Cable for UI notifications#10866jeremylenz wants to merge 1 commit intotheforeman:developfrom
Conversation
|
|
||
| production: | ||
| adapter: redis | ||
| url: redis://10.10.3.153:6381 |
There was a problem hiding this comment.
this is from the rails example and needs to be fixed
There was a problem hiding this comment.
@ehelms Do you know what the correct value is here, for the production redis server?
There was a problem hiding this comment.
It's configurable and I'd expect that the installer manages the file to configure this. I think this file should likely be one of those things where we ship a .example, similar to settings.yaml.
acb1da7 to
b491630
Compare
| adapter: redis | ||
| url: redis://localhost:6379/1 |
There was a problem hiding this comment.
I started out with async adapter, but turns out it's really unreliable because the message sender (broadcaster) and client have to be on the same process, or else the message is not received. Redis seemed to be available already, and works well in my development environment. I assume it would also work in production, but I'm not quite sure of the correct configuration and will probably need some help there.
There was a problem hiding this comment.
As I said in https://community.theforeman.org/t/revisiting-action-cable-for-notifications-6-years-later/45738/2
First reaction when I saw the title: yes please.
I'd love to see how it scales. What if you connect 100 or 500 clients, what's the impact?
Security wise: is a channel disconnected when a user is deleted?

This change (mostly) eliminates web UI polling to
GET "/notification_recipients"in favor of a WebSocket connection via Rails Action Cable.To test:
Load the web UI in the browser
Get a new notification (I used host details > Refresh applicability, but you can do anything that causes a notification in the notification bell) OR clear a notification / mark as read
Before: in the browser dev tools Network tab, you will see polling to
/notification_recipientsevery 10 seconds.After: No polling. Instead, you will see a "Socket" request to
GET /cableand notifications should appear immediately