예제 #1
0
    def session(self):
        """ Creates and returns new circuit breaker session """

        _session = CircuitBreakerSession(internal=True,
                                         circuit_breaker=self.CIRCUIT_BREAKER)
        _session.request = partial(_session.request,
                                   headers=self._headers(),
                                   timeout=self.timeout)
        return _session
예제 #2
0
    def session(self):
        """ Persistence service returns HTTP 404 if there is no skill data available
            To workaround this behaviour, make 404 a non-failure code

        """

        _session = CircuitBreakerSession(internal=True,
                                         circuit_breaker=self.CIRCUIT_BREAKER,
                                         good_codes=(range(200, 400), 404))

        _session.request = partial(_session.request,
                                   headers=self._headers(),
                                   timeout=self.timeout)
        return _session