What happens if i try to create a livekit room wit...
# server-api
b
What happens if i try to create a livekit room with the same room name that was already deleted?
r
When you try to create a LiveKit room with the same name as a previously deleted room, the system will successfully create a new room with that name . Room deletion in LiveKit completely removes all traces of the room, allowing the name to be reused immediately roommanager.go:175-202 .
b
I see thanks. So why is it that there are times we successfully delete a livekit room, and then i create a new room with the same name, i get the same room id as the one previously deleted?
The behavior is non deterministic
r
Are you doing those calls back to back?
b
If you are taking about deleting and creating, yes - the gap between the calls are short
r
Ok, I am not sure how long the "delete" process takes to complete. I would need to look into that.
b
Ok could you let me know? Also once i get the same room id as the one previously deleted, I keep getting that same deleted room id for a good amount of time, until at some pt, i get a new one
👍 1
r
Can you give me a link to a room where this happened from your LiveKit dashboard?
I would like to check the logs for it
b
Yeah this is one example RM_A3P6WodfL9gF
r
Thanks
b
Thank you for checking
@refined-appointment-81829 Were you able to check any?
Weird because it says room is deleted. Is the previous room id being cached or something?
r
I've not had a chance yet. Will take a quick look now.
Do you call
ListParticipants
every minute?
b
We dont call it every minute but we do call it every often
👍 1
r
What is your usecase?
b
We're using livekit rooms to service our realtime streaming application for meetings (think an internal version of twitch for business professionals). We have a case in which users are starting and stopping meetings very quickly (opening and closing livekit rooms) within 2-3 seconds of each other. Each room name is just the userId of the meeting owner & may not change in back to back meetings. We want to ensure that each time someone starts a meeting, we guarantee that that a fresh new room will be created, and the old room will be deleted
👍 1
r
Ok, and appending random value to the end of the room name does not work for your usecase?
m
@refined-appointment-81829 (James' coworker here) it does, it just introduces a LOT of complexity. We're trying to avoid that unless absolutely necessary
is there a way around this?
r
I am still looking into why what you are doing is not working.
m
ok thank you so much
r
Ok, chatted with the server team on this. There is not a way to work around this. If you specify a room name that was recently used (say last 30 seconds) you can get the same room ID again. Also, you should look for a method to not spam the ListParticipants API endpoint. Can you track that using your own server cache?
m
ok i see. thank you so much for looking into this @refined-appointment-81829! you've been awesome to work with. Let us know if you're ever in nyc, would love to treat you to coffee 🙂
so the only way to deal with this is to create new rooms?
we can probably call ListParticipants a bit less, but what does that do for us? @refined-appointment-81829
can you explain more in detail as to why we can't delete and re-create rooms within 30 seconds?
r
There is a caching time so that we will reusing the room id if we find it.