Posted by catch on November 5, 2010 at 6:03am
3 followers
| Project: | Vote Up/Down |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | catch |
| Status: | closed (fixed) |
| Issue tags: | Performance |
Issue Summary
vud_widget_proxy() issues a number of database queries whether or not the widget used is actually going to use the result or not.
I added a permissions check to confirm whether the user viewing the widget is allowed to vote or not before trying to look up their vote, this saves 90 queries when viewing 90 comments showing the widget.
It looks like some of the other queries could be consolidated or run selectively but can't see a simple way to do this generically.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| user_votes.patch | 488 bytes | Idle | FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch user_votes.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. | View details |
Comments
#1
Thanks for the patch :-)
Right, we need to use that patch, but, since I also added positives/negatives, I think we can also avoid that queries(2 less queries per widget show ;-)) after #968630: Let widgets modify template variables gets in.. so I hopefully will be providing a patch for this after the other issue is fixed.
#2
#3
+++ vud.theme.inc (working copy)@@ -150,7 +150,7 @@
+ $user_vote = user_access('user vote up/down') ? votingapi_select_single_vote_value($criteria) : 0;
minor typo in the permission name fixed.
As mentioned, this patch only query positives and negatives for upanddown widget, since it is the only place where it is used.
@catch: it would be great if you can take a look at this before committing it, just in case you want to add something.
Powered by Dreditor.
#4
a little addition: fix documentation.
#5
Ok, committed to 3.x.
#6
Sorry I was away over the weekend, will try to get this reviewed and tested a bit more tomorrow post-commit.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.