#NEWLINE# @ gen . coroutine #NEWLINE# def RunOnce( ) : #NEWLINE# #INDENT# db_client = DBClient . Instance ( ) #NEWLINE# http_client = AsyncHTTPClient ( ) #NEWLINE# ITunesStoreClient . SetInstance ( 'prod' , ITunesStoreClient ( environment = 'prod' , http_client = http_client ) ) #NEWLINE# OpManager . SetInstance ( OpManager ( op_map = DB_OPERATION_MAP , client = db_client , scan_ops = False ) ) #NEWLINE# last_key = None #NEWLINE# while True : #NEWLINE# #INDENT# ( results , last_key ) = ( yield gen . Task ( Subscription . Scan , db_client , None , limit = 1000 , excl_start_key = last_key ) ) #NEWLINE# for sub in results : #NEWLINE# #INDENT# if ShouldProcess ( sub ) : #NEWLINE# #INDENT# ( yield ProcessSubscription ( db_client , sub ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( http_client is None ) : #NEWLINE# #INDENT# break