themetanull
03/13/2023, 4:11 PMJacob Wright
03/13/2023, 5:15 PMJacob Wright
03/13/2023, 6:13 PMidFromName
with the same never-before-used name? Or are there guards around that?Dani Foldi
03/13/2023, 6:18 PMDani Foldi
03/13/2023, 6:19 PMSkye
03/13/2023, 6:21 PMidFromName
with that name in a while, it'll naturally lose the cache and have to look it up againJacob Wright
03/13/2023, 10:51 PMidFromName
doesn't return a promise since it can be async.HardAtWork
03/13/2023, 10:52 PMJacob Wright
03/13/2023, 10:59 PMidFromName('new-name')
and a worker in EU calls idFromName('new-name')
at the same time, they'll both have different ids. When they call fetch(req)
will they both get a different DO instance, or will the system ensure they are routed to the same DO? I'm looking at using the DO mechanism so that multiple players of an AI text game who are hitting the same un-generated branch of that game will be able to request it and have a unique DO for that branch ensure the request to generate the AI response only happens once and is returned to both players and caches the response in R2 for future players who go down that particular branch. I'm not sure if the guarantee for 1 DO in the world for a given name extended to this case when 2 clients could be asking for the same new name at the same moment.Larry
03/14/2023, 12:18 PMidFromName
calls will meet up somewhere in the ether and one will win so that there will only ever be one DO that matches that "name". This cross coordination occurs before a fetch can be called, so they will be "routed to the same DO". That said, I don't know if anyone on this channel has seen the actual code and sequence diagrams that confirm it achieves this intention, but if it doesn't work this way, it's a bug, not expected.ckoeninger
03/14/2023, 2:17 PMckoeninger
03/14/2023, 2:17 PMHardAtWork
03/14/2023, 2:19 PMckoeninger
03/14/2023, 2:20 PMHardAtWork
03/14/2023, 2:20 PMDani Foldi
03/14/2023, 2:21 PMHardAtWork
03/14/2023, 2:21 PMckoeninger
03/14/2023, 2:21 PMHardAtWork
03/14/2023, 2:21 PMckoeninger
03/14/2023, 2:21 PMckoeninger
03/14/2023, 2:21 PMckoeninger
03/14/2023, 2:22 PMHardAtWork
03/14/2023, 2:22 PMckoeninger
03/14/2023, 2:22 PMHardAtWork
03/14/2023, 2:24 PMckoeninger
03/14/2023, 2:24 PMHardAtWork
03/14/2023, 2:26 PMHardAtWork
03/14/2023, 2:27 PMJacob Wright
03/14/2023, 3:19 PMlocationHint
could work. Just need to route connections to a nearby pool.
Edit: I have one Coordinator DO for the DO location nearest a Worker request, referenced by colo name. It is in charge of creating new Pool DOs and assigning connections to them and keeping them from being too full or too empty. The Coordinator DOs just need to be close. So I need the information on the Worker request.cf object. The Coordinator name is arbitrary. I could have one Coordinator per Worker colo, but that would be too granular for our size. One per locationHint would work. So if a worker had request.cf.locationHint
I could manage pools easily that way.