IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 12, 2008, 12:04:53 PM (18 years ago)
Author:
jhoblitt
Message:

add --timeout option to all ds*ls utilties and other minor doc changes
add the ability to all DataStore::* classes that handle HTTP to pass options directly to LWP::UserAgent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStore/scripts/dsleech

    r16582 r17637  
    11#!/usr/bin/env perl
    22
    3 # Copyright (C) 2006  Joshua Hoblitt
     3# Copyright (C) 2006-2008  Joshua Hoblitt
    44#
    5 # $Id: dsleech,v 1.9 2008-02-22 01:50:43 jhoblitt Exp $
     5# $Id: dsleech,v 1.10 2008-05-12 22:04:53 jhoblitt Exp $
    66
    77use strict;
     
    1818use Pod::Usage qw( pod2usage );
    1919
    20 my ($dir, $uri, $last_fileset, $overwrite, $recall, $remember, $verbose);
     20my ($dir, $uri, $last_fileset, $overwrite, $recall, $remember, $verbose, $timeout);
    2121
    2222GetOptions(
     
    2828    'remember'          => \$remember,
    2929    'verbose|v'         => \$verbose,
     30    'timeout|t'         => \$timeout,
    3031) or pod2usage( 2 );
    3132
     
    3536    -exitval => 3,
    3637) unless defined $uri;
     38
     39# default http request timeout is 30s
     40$timeout ||= 30;
    3741
    3842my %p = (
     
    5963}
    6064
    61 my $response = DataStore::Product->new(%p)->request;
     65my $response = DataStore::Product->new(%p)->request(
     66    ua_args  => { timeout => $timeout },
     67);
     68
    6269unless (defined $response->is_success) {
    6370    die "request failed: ", $response->status_line;
     
    96103        print "processing fileset: $fileset->fileset $n/@$filesets\n" if $verbose;
    97104
    98         my $response = $fileset->request;
     105        my $response = $fileset->request(
     106                ua_args  => { timeout => $timeout },
     107            );
    99108        unless (defined $response->is_success) {
    100109            warn "request failed: ", $response->status_line;
     
    155164        print "fetching ", $file->fileid, "..." if $verbose;
    156165
    157         my $response = $file->request( filename => $filename );
     166        my $response = $file->request(
     167                filename => $filename,
     168                ua_args  => { timeout => $timeout },
     169            );
    158170        unless (defined $response->is_success) {
    159171            warn "request failed: ", $response->status_line;
     
    261273This flag is optional.
    262274
     275=item * --timeout|-t
     276
     277The ammount of time (in seconds) to wait for a response from the DataStore
     278after making an HTTP request.  The default is 30s.
     279
     280Optional.
     281
    263282=back
    264283
     
    277296=head1 COPYRIGHT
    278297
    279 Copyright (C) 2006  Joshua Hoblitt.  All rights reserved.
     298Copyright (C) 2006-2008  Joshua Hoblitt.  All rights reserved.
    280299
    281300This program is free software; you can redistribute it and/or modify it under
     
    297316=head1 SEE ALSO
    298317
    299 L<dsproductls>, L<dsfilesetls>, L<dsget>, L<DataStore>
     318L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore>
    300319
    301320=cut
Note: See TracChangeset for help on using the changeset viewer.