ConFoo Montreal 2026: Call for Papers

Voting

: min(nine, three)?
(Example: nine)

The Note You're Voting On

brainreflex at gmail dot com
9 years ago
Amit, kosta250

I found a workaround to avoid the dead servers and continue with rest alive.

<?php

$servers
= array(
array(
'host' => '127.0.0.1', 'port' => '4730'),
array(
'host' => '127.0.0.1', 'port' => '4731'),
array(
'host' => '127.0.0.1', 'port' => '4732'),
array(
'host' => '127.0.0.2', 'port' => '4730')
);

$client= new \GearmanClient();

foreach(
$servers as $server) {
$c = new \GearmanClient();
$c->addServer($server['host'], $server['port']);

if (@
$c->ping('ping')) {
$client->addServer($server['host'], $server['port']);
}
}

?>

<< Back to user notes page

To Top