Fast calling jobs lost any jobs

28 views
Skip to first unread message

Andy

unread,
Nov 28, 2018, 8:15:46 AM11/28/18
to Gearman
I have writing simple worker and client.
Worker does work and I can call from bash:
gearman -s -f "helloWorldJob"
Now I write client using gearman_client_do which shoulds waits:

    size_t result_size;
    gearman_return_t rc;
    void *value = gearman_client_do(gclient, "helloWorldJob", "",
                                 "a", 1, //minimal buffer size = 1
                                 &result_size, &rc);

    if (gearman_success(rc))
    {
      // Make use of value
      std::cout << "result_size = " << result_size << std::endl;
    }
    else
    {
       std::cout << "gearman_client_do failure, rc = " << rc << std::endl;
       return EXIT_FAILURE;
    }
    free(value);

If I call it from loop 100 times, I have:
p$ ./example_cpp -c
> runClient
Initialized gearman Client instance
Gearman! Hello world!
result_size = 0
result_size = 0
Gearman! Hello world!
result_size = 0
result_size = 0
result_size = 0
result_size = 0
Gearman! Hello world!
result_size = 0
result_size = 0
result_size = 0
............
result_size = 0
result_size = 0
result_size = 0
result_size = 0
result_size = 0
result_size = 0
result_size = 0
result_size = 0
result_size = 0
result_size = 0
result_size = 0
< runClient

Andy

unread,
Nov 28, 2018, 8:30:19 AM11/28/18
to Gearman
Not only fast,
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
also lost

Andy

unread,
Nov 28, 2018, 9:06:05 AM11/28/18
to Gearman
I use gearman_execute instead of gearman_client_do from
http://gearman.info/libgearman/examples.html
but was the same: no failure but no message
Answer:
Was error because I have loaded worker twice, is OK.
Reply all
Reply to author
Forward
0 new messages