Make pull list table views include/exclude more performant #431
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
As reported in #418, getting content from external connections for the pull list table when there are a lot of pulled/skipped posts ends up failing due to header size. This PR truncates the list of posts found in the sync log to include/exclude so as to avoid that failure and adjusts the UI to accommodate the change.
Alternate Designs
Initial suggestion was to strip the referer, which might help if you're right above the limit as it would let a few more characters through, but would eventually stop working. In the future, not as an alternate, we should explore generating/storing the sync log for authenticated connections on the remote side so a full include/exclude list doesn't have to be passed.
Benefits
Besides that you will no longer get a failed authentication message, this makes the pulled and skipped lists more performant, and IMO all the lists are more sensibly ordered. For pulled and skipped, only the necessary IDs for the current page are passed and in reverse order of when things were pulled/skipped (e.g. latest acted upon show up first, regardless of date), negating the need to run extra queries to sort by date on the remote site and, again IMO, match user expectations/needs for referring to those screens better. For new content, it is now sorted by ID descending instead of date to match the sync log truncation method, which means newly created content shows up at the top, as opposed to just by date.
Possible Drawbacks
Posts that were pulled/skipped a while back will start showing up in the new list again, although they are marked/styled appropriately and cannot be pulled. For sites that pull some but not all/most content, these should not show up until later pages. For sites that pull most or all content from a connection, these items will show up sooner and could lead to some weirdness where you're just getting pages and pages of already-processed content. Not great, but better than not being able to connect at all.
We can discuss changing skipped to be able to be pulled, but for the moment, it looks like this:
Verification Process
For pulled/skipped, I set the posts per page in screen options to 1, pulled/skipped posts in mixed chronology, and made sure that pagination and ordering worked as expected.
For new, I commented out the
post__not_in
argument to see pulled/skipped posts in place. I also reproduced the originally reported failure by inserting$this->sync_log = array_combine ( range( 1, 500 ), range( 1, 500 ) )
.Checklist:
Applicable Issues
Fixes #418