Yelp / python-gearman

Gearman API - Client, worker, and admin client interfaces
http://github.com/Yelp/python-gearman/
Other
242 stars 122 forks source link

Don't handle job unique special, since we're doing it wrong anyway. #19

Closed eskil closed 12 years ago

eskil commented 12 years ago

Let gearmand handle job uniques and don't stuff the data into the unique on '-'

patricklucas commented 12 years ago

shipit

rhettg commented 12 years ago

Wow, that's weird. The server is supposed handle "-":

gearman_server_job_st *
gearman_server_job_add_reducer(gearman_server_st *server,
                               const char *function_name, size_t function_name_size,
                               const char *unique, size_t unique_size,
                               const char *reducer_name, size_t reducer_size,
                               const void *data, size_t data_size,
                               gearmand_job_priority_t priority,
                               gearman_server_client_st *server_client,
                               gearmand_error_t *ret_ptr,
                               int64_t when)
{

 .. snip...

  if (unique_size == 0)
  {
    server_job= NULL;
    key= 0;
  }
  else
  {
    if (unique_size == 1 && *unique ==  '-')
    {
      if (data_size == 0)
      {
        key= 0;
        server_job= NULL;
      }
      else
      {
        /* Look up job via unique data when unique = '-'. */
        key= _server_job_hash(data, data_size);
        server_job= _server_job_get_unique(server, key, server_function, data,
                                           data_size);
      }
    }
eskil commented 12 years ago

rhettg, I think the intent was to offload the hash computation to the client, but unless you're sending ginourmous pieces of data, meh.