From 9751fdf9701f4e9e725138c1524865d35b894ce3 Mon Sep 17 00:00:00 2001 From: Mason James Date: Sat, 28 Feb 2015 03:17:49 +1300 Subject: [PATCH] Revert "Bug 13431 [QA Follow-up]: Shared FastMmap file causes issues" This reverts commit 081ce4ba27ec032e70a57d7f056e8aaa23490542. --- Koha/Cache.pm | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/Koha/Cache.pm b/Koha/Cache.pm index 06439033fa..826a4cb088 100644 --- a/Koha/Cache.pm +++ b/Koha/Cache.pm @@ -41,6 +41,7 @@ use warnings; use Carp; use Module::Load::Conditional qw(can_load); use Koha::Cache::Object; +use C4::Context; use base qw(Class::Accessor); @@ -132,28 +133,16 @@ sub _initialize_memcached { sub _initialize_fastmmap { my ($self) = @_; - my ($cache, $share_file); - - # Temporary workaround to catch fatal errors when: C4::Context module - # is not loaded beforehand, or Cache::FastMmap init fails for whatever - # other reason (e.g. due to permission issues - see Bug 13431) - eval { - $share_file = join( '-', - "/tmp/sharefile-koha", $self->{'namespace'}, - C4::Context->config('hostname'), C4::Context->config('database') ); - - $cache = Cache::FastMmap->new( - 'share_file' => $share_file, - 'expire_time' => $self->{'timeout'}, - 'unlink_on_exit' => 0, - ); - }; - if ( $@ ) { - warn "FastMmap cache initialization failed: $@"; - return; - } - return unless defined $cache; - $self->{'fastmmap_cache'} = $cache; + my $share_file = join( '-', + "/tmp/sharefile-koha", $self->{'namespace'}, + C4::Context->config('hostname'), C4::Context->config('database'), + "" . getpwuid($>) ); + + $self->{'fastmmap_cache'} = Cache::FastMmap->new( + 'share_file' => $share_file, + 'expire_time' => $self->{'timeout'}, + 'unlink_on_exit' => 0, + ); return $self; } -- 2.39.5