Problem/Motivation

The Aggregator page does not update when feeds are refreshed.

Steps to reproduce

  1. Visit the main Aggregator page.
  2. Add a feed.
  3. Refresh feed items.
  4. Visit main Aggregator page.

The main Aggregator page should be updated with new items, but new items do not appear.

Proposed resolution

Clear the main Aggregator page cache when feeds refresh.

Issue fork drupal-3214630

Command icon 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

Darren Oh created an issue. See original summary.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.1.10 (June 4, 2021) and Drupal 9.2.10 (November 24, 2021) were the last bugfix releases of those minor version series. Drupal 9 bug reports should be targeted for the 9.3.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Project: Drupal core » Aggregator
Version: 9.3.x-dev » 1.x-dev
Component: aggregator.module » Code

The aggregator module has been removed from Core in 10.0.x-dev and now lives on as a contrib module. Issues in the Core queue about the aggregator module, like this one, have been moved to the contrib module queue.

larowlan’s picture

Issue tags: +Needs tests
dcam’s picture

Title: Fix main Aggregator page not updating when feeds refresh » Invalidate /aggregator page cache when feeds update
Version: 1.x-dev » 2.x-dev

I verified that this is still an issue. The steps to reproduce it worked for me.

dcam’s picture

StatusFileSize
new989 bytes

This test demonstrates the bug by requesting /aggregator, updating feed items, then requesting /aggregator again. The test fails correctly on my local.

Unfortunately, the test is no good because I think it will invalidate the assertions that follow it. Those assertions were added by #3273873: Aggregator page contents could be empty due to missing cache context and they depend on the page not being cached. They were a problem for getting a failing test though. Requesting /aggregator?page=2 causes /aggregator to start working properly. I don't know enough to understand why that was happening, but I assume that requesting a different page's context somehow cleared the first page's context too. As a result, it took me a while just to get a failing test. I haven't figured out if the tests for both issues can go into the same method yet. Maybe if I delete all the items and then re-update the feed...

dcam’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: 3214630-6-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dcam’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new1.07 KB

Nevermind. That was easy to solve. All it needs is a cache clear before the next assertion. I verified that the cache context assertion is still working properly by undoing the fix from #3273873: Aggregator page contents could be empty due to missing cache context and testing it locally. It failed just like it's supposed to. Here's a good failing test.

Status: Needs review » Needs work

The last submitted patch, 9: 3214630-9-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dcam’s picture

Status: Needs work » Needs review
StatusFileSize
new1.75 KB

This passes and works for me locally.

larowlan’s picture

Issue tags: +DrupalSouth

I'm hoping to review this tomorrow

larowlan’s picture

Status: Needs review » Needs work
+++ b/tests/src/Functional/AggregatorRenderingTest.php
@@ -96,9 +96,20 @@ class AggregatorRenderingTest extends AggregatorTestBase {
+    // Clear the cache so that the paginated cache context can be tested.
+    drupal_flush_all_caches();

Instead of this, we *should* be able to just call $feed->save(), because the Aggregator item includes 'aggregator_feed_list' in its cache tags, saving a feed should invalidate the render cache.

Using drupal_flush_all_caches feels wrong, because effectively we're saying 'if we clear all caches does the correct thing show' which we know is the case. I think we want to instead test that saving a feed invalidates the listing.

dcam’s picture

Status: Needs work » Needs review
StatusFileSize
new1.77 KB
new854 bytes

Yes, that change worked.

  • larowlan committed 53e6182e on 2.x authored by dcam
    Issue #3214630 by dcam, larowlan: Invalidate /aggregator page cache when...
larowlan’s picture

Status: Needs review » Fixed

Looks good to me - thanks!

I'll cut a new release

dcam’s picture

Version: 2.x-dev » 1.x-dev
Status: Fixed » Active

This can apply to the 1.x branch too. I just haven't fixed its tests yet. We could apply the patch without fixing the tests first. I ran them locally without and with the fix and got the same results that I did for the 2.x branch. But I was trying to do things properly.

larowlan’s picture

Yeah fine to backport we know tests on 1.x are in a bad place

  • dcam committed e08b17dd on 1.x
    Issue #3214630 by dcam, larowlan: Invalidate /aggregator page cache when...
dcam’s picture

Status: Active » Fixed

It passed for the 1.x branch too.

dcam’s picture

Project: Aggregator » Drupal core
Version: 1.x-dev » 9.5.x-dev
Component: Code » aggregator.module
Status: Fixed » Active
Issue tags: +Needs reroll

This has been committed to contrib Aggregator. The patch in #14 can be rerolled for core, if anyone cares to do it.

rpayanm made their first commit to this issue’s fork.

rpayanm’s picture

Status: Active » Needs review
Issue tags: -Needs reroll

Please review.

darren oh’s picture

Status: Needs review » Reviewed & tested by the community

Verified on Drupal 9.5. Thank you!

longwave’s picture

Status: Reviewed & tested by the community » Fixed

9.5 has perhaps seen its last bug fix release already, but for posterity let's get this in anyway.

Committed and pushed 3892aea923 to 9.5.x. Thanks!

  • longwave committed 16e2b64f on 9.5.x
    Issue #3214630 by dcam, rpayanm, larowlan, Darren Oh: Invalidate /...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.