New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEAT(server): Add rememberduration option #4147
FEAT(server): Add rememberduration option #4147
Conversation
@Krzmbrzl updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also do 2 more things, please?
- Remove the unrelated whitespace changes ( I guess you have used some sort of auto-formatter?)
- Prefix your commit message with
src/murmur:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you have tested this to be working (using different values for rememberduration
including disabling and not setting it), right?
Wait, I think I found a problem |
OK, the problem is the Should I update that value upon user leaving (by any means)? Any tips? |
How so? Because the time difference is now between rejoining and entering a channel vs. leaving it? Hm... A quick check revealed that I guess the easiest way would be to change the documentation of that option to state that the time interval is relative to when that channel was joined. If we also change the unit of that option to be hours, I think the difference doesn't matter that much in a lot of cases. |
I think that will be a bit strange. If the user has been in the channel for a long time (> duration), he won't auto re-join upon he lost his connection accidentally. but if we change the duration to a large value just for that case, the option will become meaningless. The remember feature is only useful in several minutes after disconnecting, similar to multiplayer games. I think we still need a way to get the time of user leaving, that makes more sense, i.e. "when you lost connection, you have x minutes to reconnect, we will take you to the last channel." Is is easy to add a new column to represent user leaving time? |
Yeah it should be relatively straight forward. You just have to make sure that any existing table will be extended by that new column as well. That's part of the whole setup code that is at the top of |
Looks like the whole setup code is trying to modify db manually by the internal "version"? I guess what I need to do is
It's difficult to read anything from tons of SQL queries... I still prefer any migration mechanism |
Sounds about right, yes. And while you're on it, it might be a good idea to create a member variable that holds the current db version...
Agreed. The code is quite messy |
@deluxghost any (planned) progress here? :) |
@Krzmbrzl uhh sorry for the delay. I was just too excited to learn the new Hammer tools for Half Life Alyx recently. I am going to come back to this PR asap. |
No problem. Just wanted to get a status update to see if this PR might be abandoned :) |
I actually went ahead and did that in #4220 There I also had to dig through the database code, so now I know how stuff works in there. This means I'll be able to better assist you with this project now :D
I think you should instead create a new column |
uh yes, that's what i'm going to do btw, is there any simple db editor with GUI for debugging purposes? |
For SQLite (which is the default backend) there seems to be https://sqlitebrowser.org/ |
updated something, but i'm not sure if i did it right. and it might make sense to update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore you'll also have to change the database version (from 7 to 8) in ServerDB.h
and you'll also make sure that the upgrade process involves copying the new column as well (I'm not sure right now whether all columns are copied automatically or whether that has to be done explicitly)
Absolutely, yes |
for this, where should I look into? i don't understand where the server handles the shutting down process
it uses mumble/src/murmur/ServerDB.cpp Lines 603 to 606 in 7cd65f3
should I write like this? if (version < 4)
// sql
else if (version < 8)
// sql
else
// sql with last_seen |
Actually when thinking about this, it might get complicated as you'd have to make sure that you catch the server before it's actually shutting down in order to access the user-list... I think we might be better off if we ignore the shutdown and instead clear the
Yes |
Looks like this method won't prevent using the old value, because we should use the value first, before clear it (or the valid values will be ignored too). I think we should clear last_disconnect of every user when starting the server? It might take time, but I don't have a better idea. If we should do this, could you tell me which part of the code should I look at, please? |
oh, wait, if we don't clear last_disconnect manually, the only problem is the server might forget users' last channel earlier than expected, which isn't a big problem. so just ignore these things is also an option. |
Indeed
That sounds like a good idea to me
True, but if we can fix that, I think it'd still be better to do so :)
I think it could be as simple as adding a new slot to the This should be after this line: Line 455 in 6dd5db7
|
@deluxghost what's the status here? |
updated I spent more time on finding out how the hell the |
Okay nice |
This option allows to set a threshold on how long a user's channel should be remembered. This is useful for scenarios where users usually don't want their channel to be remembered by the server unless they had a disconnect (aka have ot re-connect after a short period of time). Implements #4143
@deluxghost I took the liberty of adjusting your commit message to fit our new commit guidelines |
Thank you very much for your contribution! :) |
The previous implementation of rememberchannelduration (mumble-voip#4147) acknowledged the unreliability of the last_disconnect database field. It used a workaround to set the last_disconnect field to NULL for every user on every start of the mumble server. However, with a default behavior for NULL, this created the unintended side-effect that rememberchannel was erroneously used for every user on their first connection after a server restart. This new implementation reverts the workaround of mumble-voip#4147 and uses the last_active database field to check if last_disconnect is reliable. If last_disconnect is unreliable, it will now use the server uptime and compare it to rememberchanneduration. We expect last_disconnect to be unreliable when the server was shut down while clients are still connected. Fixes mumble-voip#5639
The previous implementation of rememberchannelduration (mumble-voip#4147) acknowledged the unreliability of the last_disconnect database field. It used a workaround to set the last_disconnect field to NULL for every user on every start of the mumble server. However, with a default behavior for NULL, this created the unintended side-effect that rememberchannel was erroneously used for every user on their first connection after a server restart. This new implementation reverts the workaround of mumble-voip#4147 and uses the last_active database field to check if last_disconnect is reliable. If last_disconnect is unreliable, it will now use the server uptime and compare it to rememberchanneduration. We expect last_disconnect to be unreliable when the server was shut down while clients are still connected. Fixes mumble-voip#5639
The previous implementation of rememberchannelduration (mumble-voip#4147) acknowledged the unreliability of the last_disconnect database field. It used a workaround to set the last_disconnect field to NULL for every user on every start of the mumble server. However, with a default behavior for NULL, this created the unintended side-effect that rememberchannel was erroneously used for every user on their first connection after a server restart. This new implementation reverts the workaround of mumble-voip#4147 and uses the last_active database field to check if last_disconnect is reliable. If last_disconnect is unreliable, it will now use the server uptime and compare it to rememberchanneduration. We expect last_disconnect to be unreliable when the server was shut down while clients are still connected. Fixes mumble-voip#5639
The previous implementation of rememberchannelduration (mumble-voip#4147) acknowledged the unreliability of the last_disconnect database field. It used a workaround to set the last_disconnect field to NULL for every user on every start of the mumble server. However, with a default behavior for NULL, this created the unintended side-effect that rememberchannel was erroneously used for every user on their first connection after a server restart. This new implementation reverts the workaround of mumble-voip#4147 and uses the last_active database field to check if last_disconnect is reliable. If last_disconnect is unreliable, it will now use the server uptime and compare it to rememberchanneduration. We expect last_disconnect to be unreliable when the server was shut down while clients are still connected. Fixes mumble-voip#5639
The previous implementation of rememberchannelduration (mumble-voip#4147) acknowledged the unreliability of the last_disconnect database field. It used a workaround to set the last_disconnect field to NULL for every user on every start of the mumble server. However, with a default behavior for NULL, this created the unintended side-effect that rememberchannel was erroneously used for every user on their first connection after a server restart. This new implementation reverts the workaround of mumble-voip#4147 and uses the last_active database field to check if last_disconnect is reliable. If last_disconnect is unreliable, it will now use the server uptime and compare it to rememberchanneduration. We expect last_disconnect to be unreliable when the server was shut down while clients are still connected. Fixes mumble-voip#5639
…logic The previous implementation of rememberchannelduration (#4147) acknowledged the unreliability of the last_disconnect database field. It used a workaround to set the last_disconnect field to NULL for every user on every start of the mumble server. However, with a default behavior for NULL, this created the unintended side-effect that rememberchannel was erroneously used for every user on their first connection after a server restart. This new implementation reverts the workaround of #4147 and uses the last_active database field to check if last_disconnect is reliable. If last_disconnect is unreliable, it will now use the server uptime and compare it to rememberchanneduration. We expect last_disconnect to be unreliable when the server was shut down while clients are still connected. Fixes #5639
The previous implementation of rememberchannelduration (mumble-voip#4147) acknowledged the unreliability of the last_disconnect database field. It used a workaround to set the last_disconnect field to NULL for every user on every start of the mumble server. However, with a default behavior for NULL, this created the unintended side-effect that rememberchannel was erroneously used for every user on their first connection after a server restart. This new implementation reverts the workaround of mumble-voip#4147 and uses the last_active database field to check if last_disconnect is reliable. If last_disconnect is unreliable, it will now use the server uptime and compare it to rememberchanneduration. We expect last_disconnect to be unreliable when the server was shut down while clients are still connected. Fixes mumble-voip#5639 (cherry picked from commit ccbf407)
This option allows to set a threshold on how long a user's channel
should be remembered. This is useful for scenarios where users usually
don't want their channel to be remembered by the server unless they had
a disconnect (aka have ot re-connect after a short period of time).
Implements #4143