Permalink
Browse files

round robin between ticket servers in db_tickets_write

  • Loading branch information...
1 parent 161bf41 commit 97100d13bb4be8ee74433903bc1fecf7eb2085da straup committed Nov 18, 2010
Showing with 7 additions and 1 deletion.
  1. +7 −1 include/lib_db.php
View
@@ -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);
+ }
#################################################################

0 comments on commit 97100d1

Please sign in to comment.