question

Arjuna avatar image
Arjuna asked

Scheduling a cloud script to run weekly

I'm trying to pick a winner from the weekly leaderboard, so I'd like to run a cloud script function every week a few minutes before the leaderboard resets. Is there currently a way to do this?

I tried setting up a Playstream action:

com.playfab.title_statistic_version_changed, which isn't available in the dropdown, so I tried setting it as custom, but it didn't work.

 

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

We'll be adding scheduled job in an update later this year. Right now, you would need to do this as a post-reset operation (which would guarantee you're getting the correct player at the top of the leaderboard, in case someone reported a better score at the last second), by pulling down the previous week's info from S3, as described in the blog post on this: https://playfab.com/new-feature-resettable-leaderboards/.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Arjuna avatar image
Arjuna answered

Thanks Brendan.

Do you know of a good alternative to schedule a job in the meantime? I've written a node.js admin script that does what you described, but I'm new to web/server scripting and am not sure if its possible for me to schedule this to run weekly. I currently manually run this script from my computer once a week shortly after the leaderboard resets.

I know this is outside the scope of Playfab, but any suggestions you have would be appreciated. Thanks!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Until we have our job scheduler available, your best bet would be to either run it locally. If there are concerns about your local system being able to call out when the timer expires in your local tool, you may want to consider using something like Google Cloud.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.