Changeset 2681


Ignore:
Timestamp:
01/10/12 04:02:49 (4 months ago)
Author:
joni
Message:

enhancement: retry connection to oracle db on open if timed out

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/trunk/griddb/src/db.py

    r2669 r2681  
    162162            c_str = self.c_str 
    163163        self.opened = True 
    164         self.conn = self.db_module.connect(c_str) 
     164        for i in range(5): 
     165            try: 
     166                self.conn = self.db_module.connect(c_str) 
     167                break 
     168            except self.db_module.DatabaseError, e: 
     169                if 'Connect timeout' in str(e) and i < 4: 
     170                    print 'Connection timed out, retrying %d of %d' % (i+1, 4) 
    165171        self.conn.autocommit = False 
    166172 
Note: See TracChangeset for help on using the changeset viewer.