Problem/Motivation
I am currently using the Purge module with the HTTP purger to manage cached pages via cache tags on 3 varnish servers. Occasionally, one of the 3 servers needs to be taken offline for maintenance. During this time the purge module is correctly attempting to call the offline server and logging the invalidation requests as failed. This is causing performance issues because we are using the 'Late runtime processor'
Proposed resolution
The purge plugin configuration file does include a status settings (status: true) which does not do anything. Ideally, the UI should be provided a mechanism to disable/enable a purger.
Remaining tasks
TDB
User interface changes
TDB
API changes
TDB
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | alters.diff | 1.77 KB | moshe weitzman |
Issue fork purge-2757155
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nielsvm commentedI'm taking this into consideration. If and when I do accept this change, I'm unsure whether it will land in
8.x-3.0-beta5or thereafter in8.x-3.0-beta6.Comment #3
moshe weitzman commentedIn addition to disabling a purger, I'd like to disable a queuer. My use is case is that during migrations, it makes no sense to queue items. There are thousands and thousands of new entries created. I would love a state variable that can be flipped off so that a config-import isn't needed to enable/disable a queuer temporarily.
Comment #4
nielsvm commentedI'm hearing you all...
And none of it is impossible, it just requires a thorough and consistent API-first approach since currently all purge's service classes have usage of the words "enable" and "disable" already (with the meaning of installing/uninstalling).
Although I know this isn't a full fix, check out the upcoming beta8 for these drush commands:
Hope those commands unblock you in the meanwhile, but I'll think about enabling/disabling.
Comment #5
falco010I had a similar issue, I did not want to have the purger active on my local development.
In my settings.local.php I added this:
However the diagnostics service keeps logging errors now that I don't have an active purger :) But it is better then all the 1000 logs I got when it could not connect to Varnish from my local.
Comment #6
guptahemant commentedIn one of our projects we wanted to pause purging during heavy operations(like migration, bulk updates) etc, so for that we implemented a config form with a checkbox and then added a custom diagnostic check implementation like this:
In above code we are utilising `self::SEVERITY_ERROR` to indicate to the diagnostics that purging can not happen which in turn pauses the purge activity. One thing to note though is that queuers and processors will still be triggering but they will be stopped before purge requests can fire.
Comment #7
firewaller commented+1
Comment #8
guptahemant commentedBased on solution provided in #6, i have created a new contributed module: https://www.drupal.org/project/purge_control
Comment #10
moshe weitzman commentedAttached patch adds an alter hook for plugin definitions (purger, queue, queuer). This is common with plugins all around drupal.
With this patch, you can effectively disable a plugin by setting its 'types' to empty. That way it wont handle invalidations of type tag, url, everything, etc. Here is some example code:
Please ignore the issue fork and just use the attached patch. I have to sort out an auth issue with gitlab.
Comment #11
moshe weitzman commentedComment #12
rodrigoaguileraFor reference:
The solution from #5 didn't work for me, only nulling each purger
Comment #14
japerryAdded a few more with the drush commands moving to purge core. Fixed!
Comment #16
clemorphyI wish I had a more precise way than #12 to disable specific purgers.
Relying on indexes is not very safe as it could change when you add purgers or change their order.
There should be a boolean on each purger to define if it is enabled or not.
But for now #12 is my only working option.
Comment #17
pbouchereau commented@japerry
How is this fixed?
What is the command to disable a queuer?
Per #4, the available solution "isn't a full fix".
Comment #18
pbouchereau commentedIMO there is no fix here, only workarounds and for a specific use case on top of that.
The commit retitles the issue to "provide a mechanism to programatically alter purge plugins" which has a substantially different meaning.
The altering doesn't help me as I don't have steady cases where the queuer should be active or inactive.
I have a nightly migration so the queuer has to be deactivated before and activated after.
Correct me if I'm wrong, but if I used the "p-queuer-rm" and "p-queuer-add" commands I'd still have to configure the queuer.
For that I'd have to do a config import which I'd like to avoid.
A simple "drush p:queuer-off 2fb86f01dc" would be so nice... do you think it's conceivable?
Comment #19
guptahemant commented@pbouchereau In #8 i created a new contrib module, check if that helps
Comment #20
pbouchereau commentedThanks @guptahemant but if I got it right your module doesn't prevent queueing to happen, which is what I want.
Comment #21
pbouchereau commentedSince I can't change the status to "closed (won't fix)" I change the title to what was actually fixed.