Lessig2016 / pledgeservice

GNU Affero General Public License v3.0
9 stars 8 forks source link

Update handlers.py #16

Closed brafkind closed 9 years ago

brafkind commented 9 years ago

Speed up the loop that calculates pledge amounts per state per user by caching the set of all users outside the loop.

tannewt commented 9 years ago

My suggestion was: replacing "model.User.all()" with "db.Query(model.User, projection=('state'))" that way you don't load the whole user model.

aaronlifshin commented 9 years ago

The query needs to be changed to run as a server process, write its results, and the webhandler needs to just read the results.

A

On Mon, Sep 14, 2015 at 9:06 PM, Scott Shawcroft notifications@github.com wrote:

My suggestion was: replacing "model.User.all()" with "db.Query(model.User, projection=('state'))" that way you don't load the whole user model.

— Reply to this email directly or view it on GitHub https://github.com/Lessig2016/pledgeservice/pull/16#issuecomment-140244816 .