コード例 #1
0
ファイル: app.py プロジェクト: jeffkimble/connection-tracker
def run_update(signum):
    if uwsgi.is_locked(signum):
        return
    uwsgi.lock(signum)
    try:
        while True:
            try:
                logging.info('Updating accounts..')
                scan.update_accounts()
                logging.info('Updating addresses..')
                scan.update_addresses()
                break
            except:
                logging.exception('Failed to update accounts/addresses, retrying')
                time.sleep(30)

        for i in range(100):
            try:
                for acc in scan.ACCOUNTS:
                    if hash(acc) % PARALLEL == signum-1:
                        for region in os.getenv('REGIONS').split(','):
                            for i in range(3):
                                try:
                                    scan.update_connections(acc, region)
                                    break
                                except botocore.exceptions.ClientError:
                                    logging.exception('Client error')
                                    # throttling
                                    time.sleep(60)
            except:
                logging.exception('Failed to update')
            time.sleep(60)
    finally:
        uwsgi.unlock(signum)
コード例 #2
0
def run_update(signum):
    if uwsgi.is_locked(signum):
        return
    uwsgi.lock(signum)
    try:
        while True:
            try:
                logging.info('Updating accounts..')
                scan.update_accounts()
                logging.info('Updating addresses..')
                scan.update_addresses()
                break
            except:
                logging.exception(
                    'Failed to update accounts/addresses, retrying')
                time.sleep(30)

        for i in range(100):
            try:
                for acc in scan.ACCOUNTS:
                    if hash(acc) % PARALLEL == signum - 1:
                        for region in os.getenv('REGIONS').split(','):
                            for i in range(3):
                                try:
                                    scan.update_connections(acc, region)
                                    break
                                except botocore.exceptions.ClientError:
                                    logging.exception('Client error')
                                    # throttling
                                    time.sleep(60)
            except:
                logging.exception('Failed to update')
            time.sleep(60)
    finally:
        uwsgi.unlock(signum)
コード例 #3
0
ファイル: app.py プロジェクト: bocytko/connection-tracker
 def run(self):
     while True:
         try:
             for acc in self.account_ids:
                 for region in os.getenv('REGIONS').split(','):
                     for i in range(3):
                         try:
                             scan.update_connections(acc, region)
                             break
                         except botocore.exceptions.ClientError:
                             logging.exception('Client error')
                             # throttling
                             time.sleep(60)
         except:
             logging.exception('Failed to update')
         time.sleep(30)
コード例 #4
0
ファイル: app.py プロジェクト: madhuneal/connection-tracker
 def run(self):
     while True:
         try:
             for acc in self.account_ids:
                 for region in os.getenv('REGIONS').split(','):
                     for i in range(3):
                         try:
                             scan.update_connections(acc, region)
                             break
                         except botocore.exceptions.ClientError:
                             logging.exception('Client error')
                             # throttling
                             time.sleep(60)
         except:
             logging.exception('Failed to update')
         time.sleep(30)