projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
62b085f
)
fix empty queue allocation
author
Alan
<alan@roojs.com>
Fri, 13 Oct 2023 03:29:20 +0000
(11:29 +0800)
committer
Alan
<alan@roojs.com>
Fri, 13 Oct 2023 03:29:20 +0000
(11:29 +0800)
DataObjects/Core_notify_server.php
patch
|
blob
|
history
diff --git
a/DataObjects/Core_notify_server.php
b/DataObjects/Core_notify_server.php
index
485a428
..
1890862
100644
(file)
--- a/
DataObjects/Core_notify_server.php
+++ b/
DataObjects/Core_notify_server.php
@@
-199,11
+199,19
@@
class Pman_Core_DataObjects_Core_notify_server extends DB_DataObject
$p->selectAdd('server_id, count(id) as n');
$p->groupBy('server_id');
$in_q = $p->fetchAll('server_id', 'n');
+
+ // if queue is empty it will not get allocated anything.
+ foreach($ids as $sid) {
+ if (!isset($in_q[$sid])) {
+ $in_q[$sid] = 0;
+ }
+ }
$totalq = 0;
foreach($in_q as $sid => $n) {
$totalq += $n;
}
+
// new average queue
$target_len = floor( ($totalq + $total_add) / $num_servers );