Changeset 1457 for trunk/server/common


Ignore:
Timestamp:
Feb 5, 2010, 11:35:19 PM (13 years ago)
Author:
gdb
Message:
Now with lock timeouts
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/common/oursrc/hacron/hacron

    r1456 r1457  
    5959
    6060    def __enter__(self):
     61        tries = 0
    6162        while True:
    6263            try:
     
    6566                logger.error('Could not acquire lock %s.  Sleeping...' % self.name)
    6667                time.sleep(0.5)
     68                tries += 1
     69                if not tries % 60:
     70                    logger.error("Waited too long; got bored.  Clearing lock %s." % self.name)
     71                    _remove(self.name)
    6772            else:
    6873                break
     
    7176        os.close(self.lock)
    7277        _remove(self.name)
    73 
     78       
    7479def _touch(path):
    7580    """Effectively touches a file.  Returns true if successful, false
Note: See TracChangeset for help on using the changeset viewer.