File TODO changed (mode: 100644) (index a60015c..9914b9e) |
... |
... |
Seems we are cloning the namespace, before knowing if the user can push! |
179 |
179 |
[ ] For http hooks, add a header to allow people to report abuses. |
[ ] For http hooks, add a header to allow people to report abuses. |
180 |
180 |
Maybe directly a link which will lock the webhook and the |
Maybe directly a link which will lock the webhook and the |
181 |
181 |
user ability to add more webhooks? |
user ability to add more webhooks? |
182 |
|
[ ] builder on rg2 keeps saying "0 workers" till restart. worker restart does not help. |
|
183 |
|
A keepalive machanism should be implemented? Already is. |
|
184 |
|
Let's see if it is fixed with an update. |
|
185 |
182 |
[ ] Build jobs must not be retried if the fail is in user area. |
[ ] Build jobs must not be retried if the fail is in user area. |
186 |
183 |
[ ] job 1756: "Cannot execute" |
[ ] job 1756: "Cannot execute" |
187 |
184 |
[ ] An internal error occurred. Please try again later. @@if("@@errmsg@@" != ""){{Details: @@errmsg@@}} |
[ ] An internal error occurred. Please try again later. @@if("@@errmsg@@" != ""){{Details: @@errmsg@@}} |
File scripts/builder.php changed (mode: 100644) (index 1f3e824..7ed5438) |
... |
... |
function xnew($key, $arg) |
61 |
61 |
global $features; |
global $features; |
62 |
62 |
global $workers; |
global $workers; |
63 |
63 |
|
|
|
64 |
|
$now = time(); |
|
65 |
|
|
64 |
66 |
$workers++; |
$workers++; |
65 |
67 |
|
|
66 |
68 |
$s = &$rg_conns[$key]; |
$s = &$rg_conns[$key]; |
|
... |
... |
function xnew($key, $arg) |
69 |
71 |
$s['db'] = $arg; |
$s['db'] = $arg; |
70 |
72 |
$s['auth'] = 0; |
$s['auth'] = 0; |
71 |
73 |
$s['artifacts'] = array(); |
$s['artifacts'] = array(); |
|
74 |
|
$s['last_ping'] = $now; |
|
75 |
|
$s['last_pong'] = $now; |
72 |
76 |
unset($s); |
unset($s); |
73 |
77 |
|
|
74 |
78 |
$f = array( |
$f = array( |
|
... |
... |
function xdispatch_one($key, $data) |
199 |
203 |
$op = $u['op']; unset($u['op']); |
$op = $u['op']; unset($u['op']); |
200 |
204 |
rg_log_debug($key . ': op=' . $op); |
rg_log_debug($key . ': op=' . $op); |
201 |
205 |
|
|
|
206 |
|
if (strcmp($op, 'features') == 0) { |
|
207 |
|
$rg_conns[$key]['feat'] = $u['features']; |
|
208 |
|
rg_log('Client features: ' . rg_array2string($rg_conns[$key]['feat'])); |
|
209 |
|
break; |
|
210 |
|
} |
|
211 |
|
|
|
212 |
|
if (strcmp($op, 'pong') == 0) { |
|
213 |
|
$rg_conns[$key]['last_pong'] = $now; |
|
214 |
|
break; |
|
215 |
|
} |
|
216 |
|
|
202 |
217 |
if (strcmp($op, 'ANN') == 0) { |
if (strcmp($op, 'ANN') == 0) { |
203 |
218 |
if (($u['boot_time'] < $now - 30) || ($u['boot_time'] > $now + 30)) { |
if (($u['boot_time'] < $now - 30) || ($u['boot_time'] > $now + 30)) { |
204 |
219 |
$err = array( |
$err = array( |
|
... |
... |
$rg_conns['master']['func_new_arg'] = $db; |
917 |
932 |
$features = array( |
$features = array( |
918 |
933 |
'worker_stats' => 1, |
'worker_stats' => 1, |
919 |
934 |
'notify' => 1, |
'notify' => 1, |
920 |
|
'vm_stats' => 1); |
|
|
935 |
|
'vm_stats' => 1, |
|
936 |
|
'ping' => 1); |
921 |
937 |
rg_log_debug('Supported features: ' . rg_array2string($features)); |
rg_log_debug('Supported features: ' . rg_array2string($features)); |
922 |
938 |
|
|
923 |
939 |
$workers = 0; |
$workers = 0; |
924 |
940 |
$original_mtime = @filemtime(__FILE__); |
$original_mtime = @filemtime(__FILE__); |
925 |
941 |
rg_log('Waiting first connection...'); |
rg_log('Waiting first connection...'); |
926 |
942 |
do { |
do { |
|
943 |
|
$now = time(); |
|
944 |
|
|
|
945 |
|
// Check if we need to send pings or connections expired |
|
946 |
|
foreach ($rg_conns as $_k => $_i) { |
|
947 |
|
if (strcmp($_k, 'master') == 0) |
|
948 |
|
continue; |
|
949 |
|
|
|
950 |
|
if (!isset($_i['feat'])) |
|
951 |
|
continue; |
|
952 |
|
|
|
953 |
|
if (!isset($_i['feat']['ping'])) |
|
954 |
|
continue; |
|
955 |
|
|
|
956 |
|
if ($_i['last_ping'] + 10 < $now) { |
|
957 |
|
//rg_log($_k . ': Sending ping'); |
|
958 |
|
$j = array('op' => 'ping'); |
|
959 |
|
rg_conn_enq($_k, json_encode($j) . "\n"); |
|
960 |
|
$rg_conns[$_k]['last_ping'] = $now; |
|
961 |
|
} |
|
962 |
|
|
|
963 |
|
if ($_i['last_pong'] + 30 < $now) { |
|
964 |
|
rg_log($_k . ': Worker did not answer to ping! Close it!'); |
|
965 |
|
rg_conn_shutdown($_k, 2); |
|
966 |
|
} |
|
967 |
|
} |
|
968 |
|
|
927 |
969 |
// Check our mtime so we can upgrade the software and this script |
// Check our mtime so we can upgrade the software and this script |
928 |
970 |
// will restart. |
// will restart. |
929 |
971 |
clearstatcache(); |
clearstatcache(); |
File scripts/worker.php changed (mode: 100644) (index 5f6ba09..d44167e) |
... |
... |
function xhandle_one($key, $data) |
2074 |
2074 |
return; |
return; |
2075 |
2075 |
} |
} |
2076 |
2076 |
|
|
|
2077 |
|
if (strcmp($op, 'ping') == 0) { |
|
2078 |
|
//rg_log('Received ping, sending pong'); |
|
2079 |
|
$j = array('op' => 'pong'); |
|
2080 |
|
rg_conn_enq('master', @json_encode($j) . "\n"); |
|
2081 |
|
return; |
|
2082 |
|
} |
|
2083 |
|
|
2077 |
2084 |
// From here, we require a jid |
// From here, we require a jid |
2078 |
2085 |
if ($jid == 0) { |
if ($jid == 0) { |
2079 |
2086 |
$err = array('errstr' => 'job id not specified'); |
$err = array('errstr' => 'job id not specified'); |
|
... |
... |
function rg_worker_connect() |
3002 |
3009 |
$rg_conns['master']['exit_on_close'] = 1; |
$rg_conns['master']['exit_on_close'] = 1; |
3003 |
3010 |
$rg_conns['master']['func_data'] = 'xhandle'; |
$rg_conns['master']['func_data'] = 'xhandle'; |
3004 |
3011 |
|
|
|
3012 |
|
// Sending our features |
|
3013 |
|
$j = array('op' => 'features', 'features' => array('ping' => 1)); |
|
3014 |
|
rg_conn_enq('master', @json_encode($j) . "\n"); |
|
3015 |
|
|
3005 |
3016 |
// announce ourselves |
// announce ourselves |
3006 |
3017 |
$ann = $conf; |
$ann = $conf; |
3007 |
3018 |
unset($ann['key']); |
unset($ann['key']); |