#NEWLINE# def update( self , queue , job_id , delay = None , failure = None ) : #NEWLINE# #INDENT# spec = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( delay is not None ) : #NEWLINE# #INDENT# now = datetime . datetime . utcnow ( ) #NEWLINE# spec [ '$set' ] = { #NEWLINE# #INDENT# 'scheduled_time' : ( now + datetime . timedelta ( seconds = delay ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if failure : #NEWLINE# #INDENT# spec . update ( { #NEWLINE# #INDENT# '$push' : { #NEWLINE# #INDENT# 'failures' : failure , #NEWLINE# #UNINDENT# } , #NEWLINE# '$inc' : { #NEWLINE# #INDENT# 'retries' : ( - 1 ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if ( not spec ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# c = self . get_queue_collection ( failure ) #NEWLINE# c . update ( { #NEWLINE# #INDENT# '_id' : ObjectId ( job_id ) , #NEWLINE# #UNINDENT# } , spec )