Ticket #5557 (closed enhancement: fixed)

Opened 11 months ago

Last modified 11 months ago

wxr importer: defer comment counts

Reported by: tellyworth Assigned to: anonymous
Priority: normal Milestone: 2.5
Component: General Version:
Severity: normal Keywords: has-patch
Cc:

Description

Comment counts are calculated and recalculated every time a comment is inserted. That's inefficient when there are multiple comments per post.

The enclosed patch implements and uses a wp_defer_comment_counting() function. It's based on wp_defer_term_counting().

I also removed the comment_exists() check in the importer, since in practice it always returns false (the post_exists() check means we only attempt to import comments when the parent post is new, and hence has no comments).

Attachments

defer-comment-counts-r6528-2.patch (3.6 kB) - added by tellyworth on 01/01/08 00:38:10.
defer-comment-counts-r6528-3.patch (3.7 kB) - added by tellyworth on 01/01/08 01:22:08.
fix a poor assumption with comment_exists() change

Change History

01/01/08 00:38:10 changed by tellyworth

  • attachment defer-comment-counts-r6528-2.patch added.

01/01/08 00:48:36 changed by lloydbudd

  • milestone changed from 2.5 to 2.4.

01/01/08 01:22:08 changed by tellyworth

  • attachment defer-comment-counts-r6528-3.patch added.

fix a poor assumption with comment_exists() change

01/01/08 01:25:19 changed by tellyworth

Lloyd pointed out the comment_exists() change made a poor assumption. It didn't support a common use case where a second import is run after a first pass to catch up on comments that were added during the transition period. The second patch fixes this: it does the comment_exists() check when the post already exists, and skips it when it does not.

01/01/08 17:03:52 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [6532]) Defer comment counting. Props tellyworth. fixes #5557