Skip to content

Commit

Permalink
Merge pull request #122 from p-alik/memcache
Browse files Browse the repository at this point in the history
bug fixing of libmemcached plugin

Reviewed-by: Clint Byrum <clint@fewbar.com>
             https://github.com/SpamapS
  • Loading branch information
bonnyci[bot] authored Jul 19, 2017
2 parents 081878d + 2d74026 commit 3b1621f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions libgearman-server/plugins/queue/libmemcached/queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit 3b1621f

Please sign in to comment.