-
Notifications
You must be signed in to change notification settings - Fork 255
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
Multiple workers with Redis don't invalidate cache #154
Comments
I don't know why you're filing this as a Daphne issue - there is no caching anywhere in the Daphne/Channels system. If you're using Django's caching, there is docs on how to manually evict things from it as long as you know the cache key: https://docs.djangoproject.com/en/2.0/topics/cache/ |
Sorry for the other replay, I thought that it would be more suited there. I don't have any caching system added, not even Django's. But for some reason, when I have multiple workers in the Daphne/Redis setup, after making a change in the app and refreshing, at times the change is visible, at other times, not. With one worker everything works ok. So I think that Redis invalidates the cache, but the workers do not. |
Did you try restarting all the workers? They don't auto-reload. |
No. But this does not really help. Do I have to restart the worker each time something changes inside the app? By change I am not referring to code, but to CRUD on actual data from DB. |
No, data should not be affected. I can't help until you can prove this is a problem with one of the Channels code pieces though - I've run multiple workers and don't see this issue at all, and I can't see what would do it that we ship. You could maybe try swapping to the IPC channel layer and see if that changes anything? |
The project is running on Windows, that's why I only considered Redis. |
Hello,
After deploying Django with Daphne and Redis (asgi_redis) as in documentation, I made a Circus config to run 4 workers, Redis and Daphne. The problem is that using multiple workers, the cache is not invalidated at some times. For example I make a change in the app and start refreshing. Sometimes the change will appear, sometimes not. Also, the frontend part of the app is separate (a React app) and not using Django templates. I found no way to specify exactly when to invalidate the cache (after an action, not a number of seconds). And when I use only one worker I don't have this issue. Is this a bug or am I doing something wrong?
Versions:
asgi-redis==1.4.3
channels==1.1.8
daphne==1.4.2
Django==1.11.9
The text was updated successfully, but these errors were encountered: