Пример #1
0
    def __init__(self, *args, **kwargs):
        '''Repeatedly attempt to establish a MongoDB connection.

        Arguments are passed to :class:`pymongo.connection.Connection`.
        '''

        self._conn_args = args, kwargs
        self._conn = None
        Trier.__init__(self, self._try_connect, backoff=ExpBackoff(cap=600))
Пример #2
0
    def __init__(self, *args, **kwargs):
        '''Repeatedly attempt to establish a MongoDB connection.

        Arguments are passed to :class:`pymongo.connection.Connection`.
        '''

        self._conn_args = args, kwargs
        self._conn = None
        Trier.__init__(self, self._try_connect, backoff=ExpBackoff(cap=600))
Пример #3
0
    def test_start_stop(self):
        '''It should start and stop within 0.1 second.'''
        def f():
            return False

        trier = Trier(f)
        trier.stop()
        trier.join(timeout=0.1)
        self.assertFalse(trier.is_alive())
Пример #4
0
    def test_start_stop(self):
        '''It should start and stop within 0.1 second.'''

        def f():
            return False

        trier = Trier(f)
        trier.stop()
        trier.join(timeout=0.1)
        self.assertFalse(trier.is_alive())