Question about Tournament/Leaderboard function hooks

If I create a tournament/leaderboard that resets once a week, is there a way to have it call a Go function whenever it resets?

Also if I am running multiple server nodes, and I have a function call for granting rewards for a tournament such as in the Tournament doc: initializer.RegisterTournamentEnd(distributeRewards);
Would this be called on each node when a tournament ends? If so what would you suggest to prevent multiple calls to distributeRewards?

@jerryf There’s a function hook already provided in the server framework for Leaderboard or Tournament resets:

https://heroiclabs.com/docs/gameplay-tournaments/#reward-distribution

such as in the Tournament doc: initializer.RegisterTournamentEnd(distributeRewards);

It looks like you found the function in the docs.

Would this be called on each node when a tournament ends? If so what would you suggest to prevent multiple calls to distributeRewards?

The server is already designed to nominate a main node within the cluster which prevents concurrent execution of the callback functions on leaderboards and tournaments.

Thanks for the response. So if initializer.RegisterTournamentEnd gets fired off when the tournament resets, is there anything called when the duration of the tournament is over? For example a tournament that resets everyday but only has a one hour duration, are there events for both times?

@jerryf The callbacks fires when the tournament or leaderboards resets/rolls over. There’s no separate event for when the reset schedule occurs that’s different to when the duration ends. In that case the callback will fire once each day after the duration for that day has been reached.

What reason would you want the callback to fire once for each of those events?

I want to run a collection of tournaments or leaderboards with fixed participant sizes every weekend. I want to distribute rewards at the end of the weekend, but I also want to know if I can call some setup function when the tournament restarts at the start of every weekend

I want to run a collection of tournaments or leaderboards with fixed participant sizes every weekend.

Tournaments are designed to allow only a fixed set of participants to join. They can be configured to be run on the weekend and over the duration of two days.

but I also want to know if I can call some setup function when the tournament restarts at the start of every weekend

Isn’t this use case covered by the tournament reset functionality already in the server? Run the logic to distribute rewards and run the setup logic for the next tournament even if it doesn’t start until after the weekdays are over.

Isn’t this use case covered by the tournament reset functionality already in the server? Run the logic to distribute rewards and run the setup logic for the next tournament even if it doesn’t start until after the weekdays are over.

Thanks, yes, that might work just as well.