-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The New <IPublishedContentCache> NOT is refreshing cache for Subscriber servers on load balanced environment #17263
Comments
Hi there @IbrahimMNada! Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better. We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
After some investigations it turned out that the We need to define a way to notify the subscribers that cache of the publisher has been changed in order to delete the current in memory cached keys I searched .dotnet core for any hints regarding the hybrid cache behind a load balancer and i didn't found much info. this is a pretty interesting topic I would gladly help you Hello ,@Zeegaan , this maybe interesting to you since you're who developed this in v15 I can think of a solution for this and my thoughts goes like follows:
Regards |
Heyo 👋 Great to hear your thoughts on this 😁 |
I worked around it with something similar to what you have said , this is my work for the time being , I connected it with a web-hook , if you find it worth doing i will be more than happy to help with it using Microsoft.Extensions.Caching.Hybrid;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Services.Changes;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Sync;
namespace Tanmiah.External.Cms.Web.DeliveryApi.Composers
{
public class ContentCacheRefresherNotificationHandler : INotificationAsyncHandler<ContentCacheRefresherNotification>
{
private readonly HybridCache _hybridCache;
private readonly IServerRoleAccessor _serverRoleAccessor;
public ContentCacheRefresherNotificationHandler(HybridCache hybridCache, IServerRoleAccessor serverRoleAccessor)
{
_hybridCache = hybridCache;
_serverRoleAccessor = serverRoleAccessor;
}
public async Task HandleAsync(ContentCacheRefresherNotification notification, CancellationToken cancellationToken)
{
if (_serverRoleAccessor.CurrentServerRole == ServerRole.SchedulingPublisher)
return;
if (notification.MessageObject is not ContentCacheRefresher.JsonPayload[] payloads)
{
return;
}
foreach (ContentCacheRefresher.JsonPayload payload in payloads)
{
if (payload.ChangeTypes is not TreeChangeTypes.RefreshNode or TreeChangeTypes.RefreshBranch)
{
return;
}
await _hybridCache.RemoveAsync(payload.Key.Value.ToString() + "+draft");
await _hybridCache.RemoveAsync(payload.Key.Value.ToString());
}
}
}
} |
Even with tags, I don't think it will be very helpful when it comes to in memory caching in hybrid caching. How will the first node get access to the other node ? I have open this proposal on Dotnet extensions repo dotnet/extensions#5517 |
Fixed in #17296 |
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
15+
Bug summary
When having multiple nodes , one is
SchedulingPublisher
and the others areSubscriber
,using the extension methodSetServerRegistrar
.and when you change a nodes content at the Backoffice, there are no changes at the Subscriber nodes
we need to reset the cache for it to be reflected.
My config like follows :
Specifics
No response
Steps to reproduce
Having 2 nodes , one is
SchedulingPublisher
and another isSubscriber
.change content at the
SchedulingPublisher
,nothing is changed on the
Subscriber
Expected result / actual result
Expected result : changes should be reflected.
actual result: No changes
This item has been added to our backlog AB#45026
The text was updated successfully, but these errors were encountered: