GearmanWorker::addServers

(PECL gearman >= 0.5.0)

GearmanWorker::addServersAñade múltiples servidores de trabajos

Descripción

public GearmanWorker::addServers(string $servers = null, bool $setupExceptionHandler = true): bool

Añade uno o múltiples servidores de trabajos al agente. Serán añadidos a una lista de servidores que podrán ser utilizados para ejecutar trabajos. No se realiza ninguna operación de I/O de socket aquí.

Parámetros

servers

Una lista de servidores de trabajos separados por comas, en formato host:port. Si el puerto no se especifica, se utilizará el valor por omisión 4730.

Valores devueltos

Devuelve true en caso de éxito o false en caso de error.

Ejemplos

Ejemplo #1 Añadir 2 servidores de trabajos

<?php

$worker
= new GearmanWorker();
$worker->addServers("10.0.0.1,10.0.0.2:7003");

?>

Ver también

add a note

User Contributed Notes 1 note

up
0
matthew day
13 years ago
as of this note, the current released version of gearman doesn't really work so well to add multiple servers, although it's fixed in SVN

see: https://bugs.php.net/bug.php?id=59423

if i just add one server to my worker, it works just fine and sits and waits for a job to do

if I have more than 1 server in my worker, i get a timeout warning which causes the worker to generate a php notice and the while loop fails.
To Top