~bluet/smpms/no-db-reconn

« back to all changes in this revision

Viewing changes to SMpMS.pl

  • Committer: BlueT - Matthew Lien
  • Date: 2011-01-19 08:34:10 UTC
  • Revision ID: bluet@ubuntu-rocks-20110119083410-3mtd8s4e4cfgdfft
cancel db_reconn when db_retry_max reached

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
# FIXME: should reload config and re-initial all DB connections when $SIG{'HUP'}
61
61
$SIG{'HUP'} = sub {
62
62
        %config = %{ &read_from_config($config_file) };
 
63
        undef %DBs;
63
64
        %DBs = %{ &initial_db_connection(\%config) };
64
65
};
65
66
 
68
69
        #~ sleep $interval;     # FIXME: this should be configured in AE way.
69
70
        print `date`."\n";
70
71
        # fillout
 
72
        
 
73
        undef %DBs;
 
74
        %DBs = %{ &initial_db_connection(\%config) };
 
75
        
71
76
        #~ my ($db,$status) = &get_info_from_db(\%DBs, \%config);
72
77
        my ($status) = &get_info_from_db(\%DBs, \%config);
73
78
        #~ %DBs = %$db;
130
135
                                        #~ $log_handle->push_write ("DBI Error: $@ at $_[1]:$_[2]\n");
131
136
                                        print "DBI Error: $@ at $_[1]:$_[2]\n";
132
137
                                        print "dbh: ".Dumper($DBs{"$ip:$port:$dsc"});
133
 
                                        %DBs = %{ &initial_db_connection(\%config) };
 
138
                                        #~ %DBs = %{ &initial_db_connection(\%config) };
 
139
                                        $aecv_local->end;
134
140
                                },
135
141
                                on_connect => sub {
136
142
                                        #~ my $dbh = shift;
232
238
        my $retry_count = shift || 0;
233
239
        say "Retry counter is $retry_count";
234
240
        if ($retry_count >= $db_retry_max) {
235
 
                say "GOING TO RE-INITIAL DB CONNECTIONS" if $debug;
236
 
                %DBs = %{ &initial_db_connection(\%config) };
237
 
                say "RE-INITIAL DB CONNECTIONS DONE" if $debug;
 
241
                say "Reached DB Retry Max";
 
242
                #~ say "GOING TO RE-INITIAL DB CONNECTIONS" if $debug;
 
243
                #~ undef %DBs;
 
244
                #~ %DBs = %{ &initial_db_connection(\%config) };
 
245
                #~ say "RE-INITIAL DB CONNECTIONS DONE" if $debug;
238
246
                $aecv->end;
239
247
                $aecv_local->end;
240
248
                say "SENT AECV END" if $debug;