Skip to content

Commit

Permalink
pointsmgr: Avoid spawning a task if there are no dynamics at all
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Oct 23, 2023
1 parent d38d2f7 commit 3840c66
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/pointsmgr.pike
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ continue Concurrent.Future update_all_rewards(object channel) {
@hook_variable_changed: void notify_rewards(object channel, string varname, string newval) {
//TODO: Figure out which rewards might have changed (ie which are affected by
//the variable that changed) and update only those.
if (channel->config->dynamic_rewards) return;
if (pending_update_alls[channel->userid]) return; //If multiple variables are updated all at once, do just one batch of updates at the end
pending_update_alls[channel->userid] = 1;
call_out(spawn_task, 0, update_all_rewards(channel));
Expand Down

0 comments on commit 3840c66

Please sign in to comment.