zoukankan      html  css  js  c++  java
  • lwp 模拟行锁堵塞 前端超时

    jrhmpt01:/root/async# cat a2.pl 
    use  LWP::UserAgent;
    use utf8;
    use DBI;
    use POSIX;
    use HTTP::Date qw(time2iso str2time time2iso time2isoz);
    
    
    my $ua = LWP::UserAgent->new;
    $ua->timeout(10);
    $ua->env_proxy;
    $ua->agent("Mozilla/8.0");
    
    
    $time1=time2iso(time());
    print "$time1 is $time1
    ";
    my $response = $ua->get('http://120.55.118.6:3000/api/update?id=1');
    if ($response->is_success) {
    print   $response->decoded_content;  # or whatever
    }else{print   $response->decoded_content; };
    $time2=time2iso(time());
    print "$time2 is $time2
    ";
    print "111111111111111111111111111111111111
    ";
    
    
    jrhmpt01:/root/async# perl a2.pl 
    $time1 is 2016-04-16 20:03:08
    500 read timeout
    $time2 is 2016-04-16 20:03:18
    111111111111111111111111111111111111
    
    
    查看接口的事务情况:
    
    get '/api/update' => sub {
    my $dbName = 'oadb';
    my $dbUser = 'query';
    my $dbUserPass = 'xxx';
    my  $dbh = DBI->connect("dbi:Oracle:$dbName", $dbUser, $dbUserPass,{
                              RaiseError => 1,
                              AutoCommit => 0
                            }) or die "can't connect to database " ;
       my $c = shift;
    my  $id=$c->param('id');
    eval{
    $dbh->do("update query.test set id=100 where id =$id") or $!;
    $dbh->commit();
     $c->render(text =>  "update successed" );
    
    };
    
    if( $@ ) {
       #warn "Database error: $DBI::errstr
    ";
             $dbh->rollback(); #just die if rollback is failing 
              $c->render(text =>  "update failed" );
                             };
    };
    
    
    行锁堵塞,前端超时

  • 相关阅读:
    hdu 3746 Cyclic Nacklace
    hdu 3336 Count the string
    hdu 1358 Period
    hiho一下 第一周 最长回文子串
    KMP算法详解
    Java 之 static的使用方法(6)
    Jave 之方法-函数(5)
    Java 之数组(4)
    大数据-storm学习资料视频
    大数据-spark-hbase-hive等学习视频资料
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6200168.html
Copyright © 2011-2022 走看看