Skip to content

Commit

Permalink
round robin between ticket servers in db_tickets_write
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisaaronland committed Nov 18, 2010
1 parent 161bf41 commit 97100d1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/lib_db.php
Expand Up @@ -59,7 +59,13 @@ function db_fetch_paginated_users($k, $sql, $args){ return _db_fetch_paginated($
function db_write($sql){ return _db_write($sql, 'main'); }
function db_write_users($k, $sql){ return _db_write($sql, 'users', $k); }

function db_tickets_write($sql){ return _db_write($sql, 'tickets'); }
function db_tickets_write($sql){

$count = count(array_keys($GLOBALS['cfg']['db_tickets']['host']));
$k = ($count == 1) ? 1 : rand(1, $count);

return _db_write($sql, 'tickets', $k);
}

#################################################################

Expand Down

0 comments on commit 97100d1

Please sign in to comment.