1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-06 03:49:56 +02:00

Change the gc on stream sessions

It's a little suspect to automatically delete them just because another
was used. Waiting for them to expire will get rid of them plenty quick,
with less chance for weird issues.
This commit is contained in:
Paul Arthur 2013-01-15 23:15:49 -05:00
parent b8cd232a4f
commit af6fdbb67e

View file

@ -104,12 +104,8 @@ class Stream {
* gc_session * gc_session
* This function performes the garbage collection stuff, run on extend * This function performes the garbage collection stuff, run on extend
* and on now playing refresh. * and on now playing refresh.
* There is an array of agents that we will never GC because of their
* nature, MPD being the best example.
*/ */
public static function gc_session($ip='',$agent='',$uid='',$sid='') { public static function gc_session() {
$append_array = array('MPD');
$time = time(); $time = time();
$sql = "DELETE FROM `session_stream` WHERE `expire` < '$time'"; $sql = "DELETE FROM `session_stream` WHERE `expire` < '$time'";
@ -117,19 +113,6 @@ class Stream {
Stream_Playlist::clean(); Stream_Playlist::clean();
foreach ($append_array as $append_agent) {
if (strpos(strtoupper($agent), $append_agent) !== false) {
// We're done here jump ship!
return true;
}
} // end foreach
// We need all of this to run this query
if ($ip AND $agent AND $uid AND $sid) {
$sql = "DELETE FROM `session_stream` WHERE `ip`='$ip' AND `agent`='$agent' AND `user`='$uid' AND `id` != '$sid'";
$db_results = Dba::write($sql);
}
} // gc_session } // gc_session
/** /**
@ -149,7 +132,7 @@ class Stream {
"WHERE `id`='$sid'"; "WHERE `id`='$sid'";
$db_results = Dba::write($sql); $db_results = Dba::write($sql);
self::gc_session($ip,$agent,$uid,$sid); self::gc_session();
return true; return true;