From 2325c24558dfe1ca71c3e4fd098ab7ddf0b03b31 Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 6 Apr 2006 00:58:59 +0000 Subject: [PATCH] modding the result, instead of inside the hash function git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@678 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/MultiSession.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/perlmods/OpenSRF/MultiSession.pm b/src/perlmods/OpenSRF/MultiSession.pm index c25de3c..8b04732 100644 --- a/src/perlmods/OpenSRF/MultiSession.pm +++ b/src/perlmods/OpenSRF/MultiSession.pm @@ -54,9 +54,8 @@ sub new { sub _dummy_session_hash_function { my $self = shift; - $self->{_dummy_hash_counter} = 0 if (!exists($self->{_dummy_hash_counter})); - $self->{_dummy_hash_counter}++; - return ( $self->{_dummy_hash_counter} % $self->session_cap ) - 1; + $self->{_dummy_hash_counter} = 1 if (!exists($self->{_dummy_hash_counter})); + return $self->{_dummy_hash_counter}++; } sub connect { @@ -178,7 +177,7 @@ sub request { if ($self->running < $self->request_cap ) { my $index = $self->session_hash_function->($self, $method, @params); - my $ses = $self->{sessions}->[$index]; + my $ses = $self->{sessions}->[($index % $self->session_cap ) - 1]; #print "Running $method using session ".$ses->session_id."\n"; -- 2.11.0