Welcome to mirror list, hosted at ThFree Co, Russian Federation.

grpc_patch.rb « initializers « config - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a6094f85c942c49b9fde76167d280214007bbcdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

require 'grpc'

# grpc v1.42 and up introduced a regression where a non-standard
# exception, `GRPC::Core::CallError`, is raised instead of
# DeadlineExceeded: https://github.com/grpc/grpc/issues/33283.
# This patch applies https://github.com/grpc/grpc/pull/33565.
module Gitlab
  module GRPCPatch
    module ActiveCall
      def remote_read
        super
      ensure
        # Ensure we don't attempt to request the initial metadata again
        # in case an exception occurs.
        @metadata_received = true # rubocop:disable Gitlab/ModuleWithInstanceVariables
      end

      def receive_and_check_status
        super
      ensure
        # Ensure we don't attempt to request the initial metadata again
        # in case an exception occurs.
        @metadata_received = true # rubocop:disable Gitlab/ModuleWithInstanceVariables
      end
    end
  end
end

GRPC::ActiveCall.prepend Gitlab::GRPCPatch::ActiveCall