Example #1
0
    def test_kqueue_rate_limit(self):
        kq = KQueue.make(qkey='normal',
                         rate_limit='10/s')
        for i in xrange(1000):
            kq.put(i)

        with self.assertRaises(RateLimitExceeded):
            for i in xrange(10):
                kq.get(block=True)
Example #2
0
 def test_kqueue(self):
     kq = KQueue.make(qkey='normal')
     kq.put(3)
     kq.put("haha")
     kq.put(KQueue)
     kq.get()
     kq.get()
     kq.get()
     self.assertEqual(kq.qsize(), 0)
     with self.assertRaises(Empty):
         kq.get(block=False)
Example #3
0
#-*- coding=utf-8 -*-
from kikyo.worker.kqueue import KGroupQueue, KQueue

kq = KGroupQueue.make()
kq.addque('normal', KGroupQueue.make())
kq.addque('urgent', KGroupQueue.make())
kq.find('normal').addque('10.1.9.9', KQueue.make(key='10.1.9.9'))