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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-29 12:08:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-29 12:08:06 +0300
commit8b78957052d55ee6a73630082a870278b052b936 (patch)
treed1dc2415a687f795802c1d1c5079a53e09228cab /app/services/spam
parent2958635884b1dc5c8c01b5f00f0b7b7359556c37 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/spam')
-rw-r--r--app/services/spam/spam_verdict_service.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/services/spam/spam_verdict_service.rb b/app/services/spam/spam_verdict_service.rb
index 9705d8fc451..cdd699c6ee9 100644
--- a/app/services/spam/spam_verdict_service.rb
+++ b/app/services/spam/spam_verdict_service.rb
@@ -41,10 +41,10 @@ module Spam
return unless Gitlab::CurrentSettings.spam_check_endpoint_enabled
return if endpoint_url.blank?
- result = Gitlab::HTTP.try_get(endpoint_url, verdict_params)
- return unless result
-
begin
+ result = Gitlab::HTTP.post(endpoint_url, body: verdict_params.to_json, headers: { 'Content-Type' => 'application/json' })
+ return unless result
+
json_result = Gitlab::Json.parse(result).with_indifferent_access
# @TODO metrics/logging
# Expecting:
@@ -56,6 +56,10 @@ module Spam
# @TODO log if json_result[:error]
json_result[:verdict]
+ rescue *Gitlab::HTTP::HTTP_ERRORS => e
+ # @TODO: log error via try_post https://gitlab.com/gitlab-org/gitlab/-/issues/219223
+ Gitlab::ErrorTracking.log_exception(e)
+ return
rescue
# @TODO log
ALLOW