Beispiel #1
0
 def testHandler_6(self):
     pid = self.db.insert_into('aaa',{'retry': 2, 'queue': 'task',})
     tools.eq_(-2, expired.handler(self, {
         'pid': pid,
         'table':'aaa',
     }))
     tools.eq_({}, self.db.select_from('aaa', pid))
Beispiel #2
0
 def testHandler_6(self):
     pid = self.db.insert_into('aaa', {
         'retry': 2,
         'queue': 'task',
     })
     tools.eq_(-2, expired.handler(self, {
         'pid': pid,
         'table': 'aaa',
     }))
     tools.eq_({}, self.db.select_from('aaa', pid))
Beispiel #3
0
    def testHandler_7(self):
        tools.eq_(0, self.db.redis().llen('ExpiredPool') )
        pid = self.db.insert_into('aaa',{'retry': 2, 'queue':'task','timeout': 1,})
        tools.eq_(None, expired.handler(self, {
            'pid': pid,
            'table':'aaa',
        }))
        tools.eq_( '1', self.db.select_from('aaa', pid)['retry'])

        time.sleep(4)
        
        #tools.eq_(1, self.db.redis().llen('ExpiredPool') )
        tools.eq_('{"table": "aaa", "pid": 1}',  self.db.redis().rpop('test:task') )
Beispiel #4
0
    def testHandler_7(self):
        tools.eq_(0, self.db.redis().llen('ExpiredPool'))
        pid = self.db.insert_into('aaa', {
            'retry': 2,
            'queue': 'task',
            'timeout': 1,
        })
        tools.eq_(None, expired.handler(self, {
            'pid': pid,
            'table': 'aaa',
        }))
        tools.eq_('1', self.db.select_from('aaa', pid)['retry'])

        time.sleep(4)

        #tools.eq_(1, self.db.redis().llen('ExpiredPool') )
        tools.eq_('{"table": "aaa", "pid": 1}',
                  self.db.redis().rpop('test:task'))
Beispiel #5
0
 def testHandler_4(self):
     pid = self.db.insert_into('aaa',{'hello':'world'})
     tools.eq_(-2, expired.handler(self, {'pid': pid,'table':'aaa'}))
     tools.eq_({}, self.db.select_from('aaa', pid))
Beispiel #6
0
 def testHandler_3(self):
     expired.handler(self, {'pid':1,'table':None})
Beispiel #7
0
 def testHandler_2(self):
     expired.handler(None, {'pid':None,})
Beispiel #8
0
 def testHandler_1(self):
     expired.handler(None, {})
Beispiel #9
0
 def testHandler_4(self):
     pid = self.db.insert_into('aaa', {'hello': 'world'})
     tools.eq_(-2, expired.handler(self, {'pid': pid, 'table': 'aaa'}))
     tools.eq_({}, self.db.select_from('aaa', pid))
Beispiel #10
0
 def testHandler_3(self):
     expired.handler(self, {'pid': 1, 'table': None})
Beispiel #11
0
 def testHandler_2(self):
     expired.handler(None, {
         'pid': None,
     })
Beispiel #12
0
 def testHandler_1(self):
     expired.handler(None, {})