def async_renew_and_publish_task(channel_msg)
      Concurrent::Future.new(executor: thread_pool) do
        success = true
        begin
          combination = auth_channel_msg_2_combination(channel_msg)
          app_auths = app_authorizations(combination)
          renew(combination[:service_id], combination[:credentials], app_auths)
          metric_auth = app_auths[combination[:metric]]
        rescue StandardError
          # If we do not do rescue, we would not be able to process the same
          # message again.
          success = false
        ensure
          mark_auth_task_as_finished(channel_msg)
        end

        # We only publish a message when there aren't any errors. When
        # success is false, we could have renewed some auths, so this could
        # be more fine grained and ping the subscribers that are not interested
        # in the auths that failed. Also, as we do not publish anything when
        # there is an error, the subscriber waits until it timeouts.
        # This is good enough for now, but there is room for improvement.
        publish_auth(combination, metric_auth) if success
      end
    end
def async_renew_and_publish_task(channel_msg)
      Concurrent::Future.new(executor: thread_pool) do
        success = true
        begin
          combination = auth_channel_msg_2_combination(channel_msg)
          app_auths = app_authorizations(combination)
          renew(combination[:service_id], combination[:credentials], app_auths)
          metric_auth = app_auths[combination[:metric]]
        rescue StandardError
          # If we do not do rescue, we would not be able to process the same
          # message again.
          success = false
        ensure
          mark_auth_task_as_finished(channel_msg)
        end

        # We only publish a message when there aren't any errors. When
        # success is false, we could have renewed some auths, so this could
        # be more fine grained and ping the subscribers that are not interested
        # in the auths that failed. Also, as we do not publish anything when
        # there is an error, the subscriber waits until it timeouts.
        # This is good enough for now, but there is room for improvement.
        publish_auth(combination, metric_auth) if success
      end
    end
Apart from renewing the auth of the combination received, we also renew
 all the metrics of the associated application. The reason is that to renew
 a single metric we need to perform one call to 3scale, and to renew all
 the limited metrics of an application we also need one. If the metric
 received does not have limits defined, we need to perform two calls, but
 still it is worth to renew all of them for that price.

 Note: Some exceptions can be raised inside the futures that are executed
 by the thread pool. For example, when 3scale is not accessible, when
 renewing the cached authorizations fails, or when publishing to the
 response channels fails. Trying to recover from all those cases does not
 seem to be worth it. The request that published the message will wait for
 a response that will not arrive and eventually, it will timeout. However,
 if the request retries, it is likely to succeed, as the kind of errors
 listed above are (hopefully) temporary.