diff --git a/libgearman-server/plugins/queue/libmemcached/queue.cc b/libgearman-server/plugins/queue/libmemcached/queue.cc index e4ac5990c..59d34dd8c 100644 --- a/libgearman-server/plugins/queue/libmemcached/queue.cc +++ b/libgearman-server/plugins/queue/libmemcached/queue.cc @@ -202,9 +202,9 @@ gearmand_error_t LibmemcachedQueue::add(gearman_server_st *server, memcached_return_t rc= memcached_set(memc_, (const char *)key, key_length, (const char *)data, data_size, 0, (uint32_t)priority); - if (rc != MEMCACHED_SUCCESS) + if (!memcached_success(rc)) { - return gearmand_gerror(memcached_last_error_message(memc_), GEARMAND_QUEUE_ERROR); + return gearmand_gerror(memcached_strerror(memc_, rc), GEARMAND_QUEUE_ERROR); } return GEARMAND_SUCCESS; @@ -233,9 +233,10 @@ gearmand_error_t LibmemcachedQueue::done(gearman_server_st*, /* For the moment we will assume it happened */ memcached_return_t rc= memcached_delete(memc_, (const char *)key, key_length, 0); - if (rc != MEMCACHED_SUCCESS) + if (!memcached_success(rc)) { - return gearmand_gerror(memcached_last_error_message(memc_), GEARMAND_QUEUE_ERROR); + if(rc != MEMCACHED_NOTFOUND) + return gearmand_gerror(memcached_strerror(memc_, rc), GEARMAND_QUEUE_ERROR); } return GEARMAND_SUCCESS; @@ -338,10 +339,10 @@ static memcached_return_t callback_for_key(const memcached_st*, Replay* replay= (Replay*)context; memcached_execute_fn callbacks{(memcached_execute_fn)&callback_loader}; char *passable{(char *)key}; - - if (memcached_success(memcached_mget(replay->memc(), &passable, &key_length, 1))) + memcached_return_t rc = memcached_mget(replay->memc(), &passable, &key_length, 1); + if (memcached_success(rc)) { - gearmand_debug(memcached_last_error_message(replay->memc())); + gearmand_debug(memcached_strerror(replay->memc(), rc)); } /* Just void errors for the moment, since other treads might have picked up the object. */