gearman gives me GEARMAN_COULD_NOT_CONNECT, it is definitely running

前端 未结 4 702
甜味超标
甜味超标 2020-12-18 00:15

My dev server is Debian Squeeze and I\'m running Gearman 1.1.5 which I compiled from source along with the php pecl extension v1.1.1

If I run the reverse_client.php

4条回答
  •  醉梦人生
    2020-12-18 00:58

    In my case it's little different. I got this same error when I had my addServer code inside the loop.

    $client = new GearmanClient();
    for ($i=0; $i<100000; $i++) {
      $client->addServer("127.0.0.1", 4730);
      $data = json_encode(array('job_id' => $i, 'task_name' => 'send-email'));
      $client->addTaskBackground('sendEmail', $data);
    }
    $client->runTasks();
    

    And this fixed it for me:

    $client = new GearmanClient();
    $client->addServer("127.0.0.1", 4730);
    for ($i=0; $i<100000; $i++) {
      $data = json_encode(array('job_id' => $i, 'task_name' => 'send-email'));
      $client->addTaskBackground('sendEmail', $data);
    }
    $client->runTasks();
    

提交回复
热议问题