Bugzilla – Attachment 58554 Details for
Bug 17833
_initilize_memcached() warns if errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17833 - Memcached silently fails to _initilize_memcached() on the second time it is invoked
Bug-17833---Memcached-silently-fails-to-initilizem.patch (text/plain), 2.04 KB, created by
Olli-Antti Kivilahti
on 2017-01-02 11:28:12 UTC
(
hide
)
Description:
Bug 17833 - Memcached silently fails to _initilize_memcached() on the second time it is invoked
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2017-01-02 11:28:12 UTC
Size:
2.04 KB
patch
obsolete
>From b7f6afb12645f576be65c0619d86211034ffa3b1 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Mon, 2 Jan 2017 13:01:02 +0200 >Subject: [PATCH] Bug 17833 - Memcached silently fails to > _initilize_memcached() on the second time it is invoked > >When _initilize_memcached() is called the first time, it sets the >'ismemcached'-key and returns 1. > >When _initilize_memcached() is called the second time, the 'ismemcached'-key >already exists and '' is returned (this default to False in Perl). >Koha thinks that memcached is not in use and decides to use some other caching >mechanism instead. > >Cache::Memcached::Fast returns undef on server error: >https://metacpan.org/pod/Cache::Memcached::Fast#add > >Koha MUST listen to undefined, instead of False to define whether or not memcached >is properly working. > >Also added simple helpful diagnostics to help identify and log when this memcached >server connection problem arises. >--- > Koha/Cache.pm | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > >diff --git a/Koha/Cache.pm b/Koha/Cache.pm >index 80ff1ca..80bff6b 100644 >--- a/Koha/Cache.pm >+++ b/Koha/Cache.pm >@@ -146,9 +146,21 @@ sub _initialize_memcached { > utf8 => 1, > } > ); >+ > # Ensure we can actually talk to the memcached server > my $ismemcached = $memcached->set('ismemcached','1'); >- return $self unless $ismemcached; >+ if (defined($ismemcached)) { #If value is defined, memcached is alive >+ if ($ismemcached) { #Value is true so operation succeeded >+ #Ok >+ } >+ else { #Value is False, but still defined, so the 'ismemcached'-key already exists. >+ #Ok, while nothing happened >+ } >+ } >+ else { #Value is undefined, so there was an error with the server, or the connection to it >+ warn "Connection to the memcached servers '@servers' failed. Are the unix socket permissions set properly? Is the host reachable?"; >+ return $self; >+ } > $self->{'memcached_cache'} = $memcached; > return $self; > } >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17833
:
58554
|
58556
|
68162
|
70281
|
70307