Modify data of multiple, if not all, players

Just wondering for the long run, is there an api to modify multiple or all player data like a batch request?

  1. Since there are leaderboards rewarding, I assume there’s a way to send rewards to multiple players. If so, is there an api I can use in case I want to make a tool for maintenance or data management?
  2. Can I develop background jobs to handle these batch requests?

Thanks in advance!

Hello @tricko.ttg,

  1. The Nakama Console already allows you to edit some storage objects if needed, but doesn’t yet provide a way of doing bulk operations, the way we usually recommend this to be done is via some custom code using the available APIs to do changes in bulk or, if needed, run some custom SQL. You’d call the custom code either by doing your bulk ops as part of the InitModule function and deploy them to enact them (having some check that ensure they only run once), or alternatively, have a Server-To-Server custom RPC that you can call to enact them. Your

  2. Nakama doesn’t have built in background jobs, but you can use custom code to setup a custom RPC that is invoked periodically or on demand to apply whatever work needs to be done.

Hope this clarifies.

1 Like

Thanks for the response! I’ll have a look on workarounds using RPC.

Another scenario I have in mind would be having a queue of requests in the client then sending them as a batched request to the server? Something like a failsafe feature to recover when multiple requests fail. I don’t really have a specific example at the moment though.

@tricko.ttg there’s no mechanism to batch the requests themselves together, for operations that need to happen transactionally one should use walletsUpdate, multiUpdate or StorageWrite encompassing all objects that need to be updated within the same transaction.

I see… Thanks for verifying that!