#NEWLINE# def enqueue( self , envelope ) : #NEWLINE# #INDENT# 'Drops a new message in the queue for delivery. The first delivery\n        attempt is made immediately (depending on relay pool availability).\n        This method is not typically called directly, |Edge| objects use it\n        when they receive new messages.\n\n        :param envelope: |Envelope| object to enqueue.\n        :returns: Zipped list of envelopes and their respective queue IDs (or\n                  thrown :exc:`QueueError` objects).\n\n        ' #NEWLINE# now = time . time ( ) #NEWLINE# envelopes = self . _run_policies ( envelope ) #NEWLINE# ids = self . _pool_imap ( 'store' , self . store . write , envelopes , repeat ( now ) ) #NEWLINE# results = list ( zip ( envelopes , ids ) ) #NEWLINE# for ( env , id ) in results : #NEWLINE# #INDENT# if ( not isinstance ( id , BaseException ) ) : #NEWLINE# #INDENT# if self . relay : #NEWLINE# #INDENT# self . active_ids . add ( id ) #NEWLINE# self . _pool_spawn ( 'relay' , self . _attempt , id , env , 0 ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( id , QueueError ) ) : #NEWLINE# #INDENT# raise id #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return results