Cancelling UpdateAsync?

I use updateasync to retrieve the old data and then read it for my guild system, but imagine for example somebody tries to join a guild they already sent a join request to. I use updateasync() and read the table, and only add them to the table if they didn’t already send a request. But, if they already sent a request, I would like to have some way to prevent it from updating with the same exact value because I think that will slow down the datastore.

If you would like to cancel an UpdateAsync call, simply have its transformFunction return nil under whatever conditions you find unfavorable. Bear in mind, though, that this still uses up a request in your allotment.

2 Likes

So using updateasync and returning nil instead of a real value will cancel it without setting it to that?

1 Like

Correct. Values should only be removed from the DataStore if set with SetAsync to nil or, preferably, explicitly removed with RemoveAsync.

1 Like

SetAsync with a value of nil will error stating that Argument 2 is missing or nil. RemoveAsync is the only way to actually remove an entry from a DataStore.

4 Likes