DataStore:OnUpdate not firing cross-Servers

[strike]yea it doesn’t fire anymore, and the only leads I have are in the Last spoiler.[/strike]
Edit: {
it doesn’t fire cross-servers/cross-places
Game Server = Server 1
Network Server = Server 2
}

This bit of code has never failed before like a month ago (last time it was used often).

On a Game Server Place:

[spoiler][code]

local rdsSend = game:GetService(“DataStoreService”):GetDataStore(“ReplayStore”)
local rdsData = game:GetService(“DataStoreService”):GetDataStore(“ReplayMemory”)
. . . . .
function SendR(prop)
. . . .
local dsr = {} – this table holds replay Data only
local ssr = {} – this table is information on where the replay came from
ssr[“game”] = GetTeamStr()
dsr[“RData”] = PSD
dsr[“PN”] = PND
dsr[“DP”] = DPD
dsr[“numf”] = numberofframes
dsr[“sf”] = startframe
dsr[“ff”] = finalframe
ssr[“Score”] = {workspace.Data.HS.Value,workspace.Data.VS.Value}
ssr[“Period”] = workspace.Data.Period.Value
ssr[“Sender”] = workspace.Data.SendPS.Value
ssr[“AT”] = workspace.Data.AwayT.TN.Value
ssr[“HT”] = workspace.Data.HomeT.TN.Value
ssr[“Status”] = “Red”
ssr[“SID”] = game.JobId
ssr[“PID”] = game.PlaceId
ssr[“Key”] = “S”…banwag…“”
ssr[“Find”] = rdsSend:GetAsync(“Keys”) – very important this is how the
print("Respone Key is "…ssr[“Find”]) – other server knows where to send data
rdsSend:UpdateAsync(“Keys”,function(iuy) return iuy + 1 end) – this is a unique key
. . . . .
rdsSend:UpdateAsync(“Replays”,function(StoredGames)
if StoredGames == nil or StoredGames == {} then
return {ssr}
else
table.insert(StoredGames,ssr)
return StoredGames
end
end)
workspace.Data.SRLink.Value = true
rdsSend:OnUpdate(“SR”…ssr[“Find”],function(ServerResponse)
print(“INCOMEING REPORT”) – is never printed
if ServerResponse ~= nil then
workspace.Data.SeNam.Value = ServerResponse[2]
workspace.Data.SeRes.Value = ServerResponse[1]
end
end)
rdsSend:OnUpdate(“BR”…ssr[“Find”],function(IsLooking)
print(“REPLAY IS BEING WATCHED”) – is never printed
if IsLooking ~= nil then
workspace.Data.BeingViewed.Value = IsLooking
end
end)
jcon = workspace.Data.SRLink.Changed:connect(function()
if workspace.Data.SRLink.Value == false and workspace.Data.BeingViewed.Value == false then
rdsSend:UpdateAsync(“Replays”,function(StoredGames2)
for uqw = 1, #StoredGames2 do
if StoredGames2[uqw][“Find”] == ssr[“Find”] then
StoredGames2[uqw][“Status”] = “Yellow”
end
end
return StoredGames2
end)
end
end)
. . . .
end
[/code][/spoiler]

Code on the Network Place:

[spoiler][code] – Warning this Server is not FE
. . . .
local replays = {}
local rdsSend = game:GetService(“DataStoreService”):GetDataStore(“ReplayStore”)
local rdsData = game:GetService(“DataStoreService”):GetDataStore(“ReplayMemory”)

function GetNewList(new)
replays = new
end

local listofReplays = rdsSend:GetAsync(“Replays”)
if listofReplays ~= nil then
replays = listofReplays
end

rdsSend:OnUpdate(“Replays”,GetNewList) – even this will fail to fire sometimes
– although when I reset my character it runs this piece of code, but I get errors like “Script that implemented this callback has been destroyed” and “Callbacks cannot yield”

function OpenUpReplay(clip)
. . . . .
roc.W.B.MouseButton1Click:connect(function()
local CW = rdsSend:GetAsync(“BR”…clip[“Find”])
if CW == nil and HasRank(player,200) then
print("Respone Key is "…clip[“Find”]) – this gets printed
rdsSend:UpdateAsync(“BR”…clip[“Find”],function(nol) return true end)
end
. . . . .
end)
end

OpenUpReplay(replays[sframe.V.Value])
[/code][/spoiler]

This code Takes two Tables, one a Large Replay Data Table that can take up to 3 Keys in a datastore, and the other a smaller table that stores information on where the replay came from.

The second table is of Importance. It has a Index at “Find” which holds a unique Integer. Now on the Game Server there is this:

rdsSend:OnUpdate("BR"..ssr["Find"],function(IsLooking)

so it is waiting for a change to the Key “BR550” for example.

now from the Network Server there is this line:

rdsSend:UpdateAsync("BR"..clip["Find"],function(nol) return true end)

this sets the Key BR550 to true (since “ssr” and “clip” are the same table just different variable names for the different servers)

so by my understanding the Game server should pick up the change in about 6-20 seconds.

Last time it was in use often, it worked just how its described, but now it doesn’t and rdsSend:OnUpdate("BR"..ssr["Find"],function(IsLooking)
is never fired, and instead I get errors like the one in the below spoiler on the Network Server, and no errors on the Game Server.

[strike]what does this mean?[/strike]

[spoiler]

[strike]wtf imgur deleted my first image?
and my second one -.-[/strike]

whatever, I’m getting “Script that implemented this callback has been destroyed” and “Callbacks cannot yield” errors[/spoiler]
never gotten these errors before when this thing used to work.

Ok I found out a serious issue with this OnUpdate method, and I have solid evidence on it not working

some things to notice:

  1. where it says Waiting for BR553 is a confirmation that DataStore:OnUpdate(“BR553”) is hooked up.
  2. I then use command srv/553 to print the value at BR553, which is “” or nil, as shown
  3. code for srv/ elseif string.sub(msg,1,4) == "srv/" then local atkey = string.sub(msg,5) print(rdsSend:GetAsync("BR"..atkey)) print("value at "..atkey.." was print above")
  4. I then leave the server, to go to another server to change the value of BR553.
  5. Ignore the Running animation on character.
  6. I rejoin the server, and wait around 50 seconds
  7. I call srv/553 again
  8. As soon as GetAsync(“BR”…atkey) is invoked you notice that REPLAY IS BEING WATCHED is printed. if you look at the above code in OP you can see this print statement is in the :OnUpdate function
  9. the value is printed true
  10. notice I waited a solid 40 seconds for the OnUpdate to fire after joining the server, with about 10 more seconds from when I actually changed the value.

Please look into this ASAP

Looks like your onupdate is being throttled. Exactly how many updates are you subscribing to?

I’m pretty certain I replied to this thread.

Regardless - the problem more than likely is due to your OnUpdate being throttled, as Arceus said above.

It can’t possibly be throttled, these are the only OnUpdate function in the whole server, and they’re only hooked up on rare occasions, so that would be 2 total.

made a reproduce place:

it will work for like the first 2 tries, but after that it never updates.

Say TELE to teleport to the other server, you need 2 people so you can place one in each server.

Clicking the brick changes it’s color to 1 of 10 colors, and adds this to datastore key, so other servers can change the color of the brick, notice after the first like 2 attempts, if you click it on one server it wont change the color on the other server, until you click it again, at which point it will change to the color on the other server and then change to a new color.

I’m confused here. What exactly am I looking for in the repro place you linked? My OnUpdate works fine. Are you talking about OnUpdate when doing cross-place/cross-server communications, or do you mean OnUpdate is not working in general?

DataStore is not designed for instant cross-server communication. There is a cache layer that stores DataStore values locally so that the network is not over-stressed. If you make a make an update to a certain Key locally (same instance), this key will be updated immediately in the current instance of the game, however other servers will not receive the update until a timed check-in.

I’m having a hard time understanding the issue you are describing, so I hope the above information will help you narrow it down for me.

[quote] I’m confused here. What exactly am I looking for in the repro place you linked? My OnUpdate works fine. Are you talking about OnUpdate when doing cross-place/cross-server communications, or do you mean OnUpdate is not working in general?

DataStore is not designed for instant cross-server communication. There is a cache layer that stores DataStore values locally so that the network is not over-stressed. If you make a make an update to a certain Key locally (same instance), this key will be updated immediately in the current instance of the game, however other servers will not receive the update until a timed check-in.

I’m having a hard time understanding the issue you are describing, so I hope the above information will help you narrow it down for me. [/quote]

On server is instant, which it should. But cross server is not working after like the first 2 calls to OnUpdate. How long is this timed check-in? 3 mins Plus? cause I’m not getting any response on the 2nd server until GetAsync is called on that server for said key value.

On the reproduce place you need to:

  1. have 2 computers
  2. have 2 accounts both join the start server.
  3. have one of them chat “TELE” to place him in Server 2
  4. click on the part to have it change color from either server
  5. look on the other account to take notice when the color changes (should be like 6-60 seconds)
  6. keep repeating steps 4 and 5 until you see no change on the other server after like 2 mins+
  7. on the server where the color has not yet updated, click the part.
  8. notice that it changes to the color of the other server for a split second and then changes to a new color. And as before the other server will not see the change.

The OnUpdate function doesn’t fire for other servers until GetAsync is called on that server for the key value that OnUpdate is hooked up on.

Sorry, OP is confusing, my other posts make more sense.

Teleport in this place doesn’t work for me. It says I have insufficient privileges.

oh my bad I had the second server as friends only.

try now.

Confirmed bug. We found the problem and the fix, but it didn’t make it to tonight’s cut-off. Will try to force it in tomorrow night!

Seems like this has been a problem for a few weeks now, have you just noticed it?

I just noticed it since the season to my Hockey league started 5 days ago. And my game has a Review system where players can send replay to a Network type place for Staff members to review if its a goal or not. But the players on the game servers were not getting the responses that were being sent from the Network, so the players didn’t know what the call was and the game continued, causing some games to have different outcomes if the call made its way to the Server.

During off-season this part of the game is not used, so I didn’t notice it.

Thanks for the detailed repro! It helped us find the cause very quickly!

This was fixed last night. Let me know if you see any odd behavior.

Thank you!

Please don’t forget about this bug though :c

I just tested it out, and it works great, Thanks :D!

A post was moved out.

Please do not bump very old solved bug reports without good reason.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.