parameters: (self, **kwargs)
return_statement: return retry_delay
docstring: Connect as a handler to the needs-retry event.
docstring_summary: Connect as a handler to the needs-retry event.
docstring_tokens: Connect as a handler to the needs - retry event .
function: def needs_retry(self, **kwargs):
          """Connect as a handler to the needs-retry event."""
          retry_delay = None
          context = self._retry_event_adapter.create_retry_context(**kwargs)
          if self._retry_policy.should_retry(context):
              # Before we can retry we need to ensure we have sufficient
              # capacity in our retry quota.
              if self._retry_quota.acquire_retry_quota(context):
                  retry_delay = self._retry_policy.compute_retry_delay(context)
                  logger.debug("Retry needed, retrying request after "
                               "delay of: %s", retry_delay)
              else:
                  logger.debug("Retry needed but retry quota reached, "
                               "not retrying request.")
          else:
              logger.debug("Not retrying request.")
          self._retry_event_adapter.adapt_retry_response_from_context(
              context)
          return retry_delay
function_tokens: def needs_retry ( self , * * kwargs ) : retry_delay = None context = self . _retry_event_adapter . create_retry_context ( * * kwargs ) if self . _retry_policy . should_retry ( context ) : # Before we can retry we need to ensure we have sufficient # capacity in our retry quota. if self . _retry_quota . acquire_retry_quota ( context ) : retry_delay = self . _retry_policy . compute_retry_delay ( context ) logger . debug ( "Retry needed, retrying request after " "delay of: %s" , retry_delay ) else : logger . debug ( "Retry needed but retry quota reached, " "not retrying request." ) else : logger . debug ( "Not retrying request." ) self . _retry_event_adapter . adapt_retry_response_from_context ( context ) return retry_delay