Closed (fixed)
Project:
Ubercart
Version:
6.x-2.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Reporter:
Created:
24 Mar 2009 at 17:37 UTC
Updated:
10 Apr 2009 at 13:10 UTC
Jump to comment: Most recent file
On servers that have millions of rows in uc_file_users, update uc_file_update_6005() can take way too long to run its course. I have split the meat of it off into a batch function, which processes 100 row updates per.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | uc_file_update_batch.03-25-09-23-43.2.x.patch | 1.85 KB | cha0s |
| uc_file_update_batch.03-24-09-12-33.2.x.patch | 2.55 KB | cha0s |
Comments
Comment #1
Island Usurper commentedUpdate functions need to return the $ret array.
Also, I'm not sure what happens when you try to run a batch during a batch, which is how updates are done. However, it looks like update functions can say how long they take with $ret['#finished']. See the second example on http://drewish.com/node/123.
Comment #2
cha0s commentedInteresting. :) I was going by the filefield module's implementation of a batch inside an update function. I initially thought it was weird too (batch in batch action), but torgospizza said the update appeared to work on a site (the one with tons of rows...). Anyways, I changed it 'cause this way is actually more elegant, though that passing in of the $sandbox variable and the #finished quirk should be better documented. ;)
Comment #3
cha0s commented*plonk*
Comment #4
Island Usurper commentedSo, it didn't break on my test site, but I don't want to commit it until someone runs it on real data. Just in case. :)
Once I get a +1 from somebody, it should be ready to commit.
Comment #5
torgospizza+1 from me. We tested on our d6 sandbox which has 1.4 million rows in the uc_file_users table.
Originally it timed out, but with the patch (and a slight tweaking of our max_execution_time) it went without a hitch.
Comment #6
Island Usurper commentedGood deal. Committed.