I have a User model for a game system. Need to increase the points by 100 every hour.
# the key_name is the userid in this case
class User(db.Model):
points = db.IntegerProperty(default=0)
so should prepare a handler which does a GQL query across all entities? ( wouldn't that be a little slow with 500k - 1 million user entities? )
eg:
users = User.all() # if i'm not mistaken, only 1000 queries can be done.
for user in users:
user.points += 100
db.put(user)
i suppose using taskqueues, and sharding counters to overcome the 1000 limiy, I could pull it off
but then again, why don't I just take the time difference of when the user last logged in, and if it's N number of hours, I'll award the user N * 100 points? that should reduce the load on my application.
eg: class User(db.Model): lastlogin = db.DateTimeProperty() points = db.IntegerProperty(default=0)
what do you guys think?