#NEWLINE# def _ensure_indexes( self , database ) : #NEWLINE# #INDENT# 'Ensure indexes on collections.\n        ' #NEWLINE# messages = database [ self . messages_collection ] #NEWLINE# messages . ensure_index ( [ ( 'queue' , 1 ) , ( 'priority' , 1 ) , ( '_id' , 1 ) ] , background = True ) #NEWLINE# database [ self . broadcast_collection ] . ensure_index ( [ ( 'queue' , 1 ) ] ) #NEWLINE# routing = database [ routing . routing_collection ] #NEWLINE# routing . ensure_index ( [ ( 'queue' , 1 ) , ( 'exchange' , 1 ) ] ) #NEWLINE# if self . ttl : #NEWLINE# #INDENT# messages . ensure_index ( [ ( 'expire_at' , 1 ) ] , expireAfterSeconds = 0 ) #NEWLINE# routing . ensure_index ( [ ( 'expire_at' , 1 ) ] , expireAfterSeconds = 0 ) #NEWLINE# database [ self . queues_collection ] . ensure_index ( [ ( 'expire_at' , 1 ) ] , expireAfterSeconds = 0 )