Reputation: 2975
I have a website the users can do stuff like leave comments, perform likes, etc..
I want to calcluate a score for each user that is composed from these actions, i.e: Like = 10 points, comment = 20 points etc..
I would like to create a table with users score that will be calculated once a day.
Currently i use a php script and execute, but it takes too long to calculate and then it times-out..
whats the method for perfomring this?
Upvotes: 1
Views: 184
Reputation: 18133
basically what you do is add a record of what the user in your web application, instead of calculating every batch, you can:
as you have planned to update the score every day user can add a cache for a long duration so that the query does not harm performance
Upvotes: 1
Reputation: 33865
How long time does the script take?
If you just want to increase the amount of time the script is allowed to take to execute, you can make use of PHP's set_time_limit() to increase the time.
Start your script by running:
set_time_limit(120); // Script is allowed to execute for 2 minutes if necessary
Upvotes: 1