[Suggestion] Time a channel is empty

Hiho!

yesterday I wondered if it´s possible to see the time a channel was last visited and I found following:

I wondered about the fact the server is counting the time in seconds instead of showing me a timestamp the last user left the channel. So I checked the database for a field ‘seconds empty’ or similiar but I couldn´t find one. Last conclusion for me: Only the Teamspeak service is counting the time. I restarted the server and voilá… for every channel the server started counting again from 0.

And I think the only use case for this feature is to track the time for temporary channels, right? My problem is, that there are a bunch of channels that are no longer visited on our teamspeak server and we would like to let them automatically deleted after some time of no visitors, but if we set them all as temporary the channels are gonna all deleted on a restart of the teamspeak service. So this is no opinion for us.

At the moment a sinusbot is doing this job for us, but is there a chance that you will implement a feature that saves a timestamp which is recorded after the last user leaves a channel? Or did I missed something? :slight_smile:

Kind regards,

Barny

2 Likes

As you noticed correctly the seconds since a channel is empty is cached by the application.
Restarting the application will start the timers again for every channel.

The idea of adding this value to the database may sounds good but will result in a huge performance loss.
A specially for larger TeamSpeak server with a huge amount of channels.
Leaving or entering a channel would require a database request each time.
Even if this won’t be noticeable on small servers, TeamSpeak got trimmed to work on each system even very low performing ones.


Just another word to your issue in general.

The field “seconds_empty” will not give a timestamp of course.
Just calculate a unix timestamp minus “seconds_empty“ which will result in another timestamp you can convert to the date and time since the channel is empty.

I’m aware of the fact restarting the application will reset these timers and makes your calculations useless.

To get of this issue you could save those results in an own database containing the channel identifier, it’s “seconds_empty” and the mentioned calculated timestamp.

Comparing the calculated timestamp with the server uptime will tell you to use the database entry as “real” empty-since value or the provided value by the server.

Running a created script every 24 hours for example could clear unused non-temporarily channels not being used since X hours/days etc.


It’s worth to say this suggestion may be useful in your mind but basically not be needed or used by the great mass.

The integrated auto-deletion timer is a great solution in my mind even if this works for temporarily channels only.
Those channels are gone, too if the server restarts.
Since this is an issue for I wonder at this point how much restarts you do (and probably why)?

2 Likes

Hi FakE,

thanks for your detailed answer! :slight_smile:

No, not in my mind, because the application could cache it like it is already doing. We would only need a database request for starting and closing the server, so that temporary channels would still exist on restarting a server. Usually I do restarts after teamspeak server updates or the root server requires a restart. That´s not so often, but would, like you already said, makes my calculations useless.

Yes, you are right and I´m doing it right now like you said. Is the teamspeak application really incrementing some kind of integers for the calculation of ‘seconds empty’? I think the application is saving a timestamp, too, and calculates the seconds based on this timestamp to return the ‘seconds empty’ on every api call. Why not return a timestamp straight through? <-- This is only a suggestion and I do not even had a problem with this.

That´s a good solution. At the moment a wordpress plugin connects every hour to the teamspeak server query. On this call I could download the whole channel list with it´s ‘seconds empty’ value and compare them to the existing values like you said. Thanks a lot.

I´m totally with you, but it could also be used for much more things if it´s save the calculated values at some time in the database. Even if the application would save it on restart only. That would be much appreciated and maybe even the great mass will see the advantages of this feature. :wink:

Thanks a lot for your reply and your time.

1 Like
twitch instagram twitter facebook