summaryrefslogtreecommitdiff
path: root/lib/Net
diff options
context:
space:
mode:
authorAlexis Sukrieh <alexis@weborama.com>2012-07-04 15:14:10 +0200
committerAlexis Sukrieh <alexis@weborama.com>2012-07-04 15:14:10 +0200
commit5a71e04a704ebc4b3e1449e58a6ba78f68ab7b60 (patch)
tree847855150cccc0c1e17c91ac8ea90845ce2b1910 /lib/Net
parentMerge pull request #17 from dams/master (diff)
downloadnet-riak-5a71e04a704ebc4b3e1449e58a6ba78f68ab7b60.tar.gz
Support for a timeout attribute in the PBC client
The timeout option was only supported for the REST client, the PBC role did have a hard-coded timeout set to 30 seconds. This patch allows the caller to change it, by passing the timeout attrbute to the constructor. A test script is provided.
Diffstat (limited to 'lib/Net')
-rw-r--r--lib/Net/Riak/Role/PBC.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Net/Riak/Role/PBC.pm b/lib/Net/Riak/Role/PBC.pm
index 605f032..bc32e3b 100644
--- a/lib/Net/Riak/Role/PBC.pm
+++ b/lib/Net/Riak/Role/PBC.pm
@@ -37,6 +37,12 @@ has socket => (
predicate => 'has_socket',
);
+has timeout => (
+ is => 'ro',
+ isa => Int,
+ default => 30,
+);
+
sub is_alive {
my $self = shift;
return $self->send_message('PingReq');
@@ -56,7 +62,7 @@ sub connect {
PeerAddr => $self->host,
PeerPort => $self->port,
Proto => 'tcp',
- Timeout => 30,
+ Timeout => $self->timeout,
)
);
}