From 0a5f7cb5e84eaa8db0ff63d626a83463b09c240d Mon Sep 17 00:00:00 2001
From: Brett Walker <bwalker@gitlab.com>
Date: Wed, 28 Aug 2024 10:26:55 +0000
Subject: [PATCH] Rename DISABLE_BANZAI_TIMEOUT

to GITLAB_DISABLE_MARKDOWN_TIMEOUT
---
 doc/administration/environment_variables.md                 | 1 +
 lib/gitlab/render_timeout.rb                                | 2 +-
 .../banzai/filter/concerns/pipeline_timing_check_spec.rb    | 4 ++--
 .../banzai/filter/concerns/timeout_filter_handler_spec.rb   | 4 ++--
 spec/lib/gitlab/render_timeout_spec.rb                      | 6 +++---
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/doc/administration/environment_variables.md b/doc/administration/environment_variables.md
index 0997701e9cb07..1854b1d0b077b 100644
--- a/doc/administration/environment_variables.md
+++ b/doc/administration/environment_variables.md
@@ -43,6 +43,7 @@ You can use the following environment variables to override certain values:
 | `GITLAB_RAILS_CACHE_DEFAULT_TTL_SECONDS`   | integer | The default TTL used for entries stored in the Rails-cache. Default is `28800`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95042) in 15.3. |
 | `GITLAB_CI_CONFIG_FETCH_TIMEOUT_SECONDS`   | integer | Timeout for resolving remote includes in CI config in seconds. Must be between `0` and `60`. Default is `30`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/116383) in 15.11. |
 | `GITLAB_DISABLE_TOKEN_EXPIRATION_BANNER`   | string  | If set to `true`, `1`, or `yes`, the token expiration banner is not shown. Default is `false`. |
+| `GITLAB_DISABLE_MARKDOWN_TIMEOUT`          | string  | If set to `true`, `1`, or `yes`, Markdown rendering on the backend does not time out. Default is `false`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163662) in 17.4.|
 | `GITLAB_LFS_MAX_OID_TO_FETCH`              | integer | Sets the maximum number of LFS objects to link. Default is `100,000`.                                        |
 | `SIDEKIQ_SEMI_RELIABLE_FETCH_TIMEOUT`      | integer | Sets the timeout for Sidekiq semi-reliable fetch. Default is `5`. [Before GitLab 16.7](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139583), default was `3`. If you experience high Redis CPU consumption on GitLab 16.6 and earlier, or if you have customized this variable, you should update this variable to `5`. |
 
diff --git a/lib/gitlab/render_timeout.rb b/lib/gitlab/render_timeout.rb
index 85c8449493806..d1411385834d7 100644
--- a/lib/gitlab/render_timeout.rb
+++ b/lib/gitlab/render_timeout.rb
@@ -12,7 +12,7 @@ def self.timeout(background: BACKGROUND, foreground: FOREGROUND, &block)
     end
 
     def self.banzai_timeout_disabled?
-      Gitlab::Utils.to_boolean(ENV['DISABLE_BANZAI_TIMEOUT'], default: false)
+      Gitlab::Utils.to_boolean(ENV['GITLAB_DISABLE_MARKDOWN_TIMEOUT'], default: false)
     end
   end
 end
diff --git a/spec/lib/banzai/filter/concerns/pipeline_timing_check_spec.rb b/spec/lib/banzai/filter/concerns/pipeline_timing_check_spec.rb
index 44771f5aac4ec..357f4fc4e2b70 100644
--- a/spec/lib/banzai/filter/concerns/pipeline_timing_check_spec.rb
+++ b/spec/lib/banzai/filter/concerns/pipeline_timing_check_spec.rb
@@ -28,9 +28,9 @@
       expect(described_class.new('text').exceeded_pipeline_max?).to be_falsey
     end
 
-    context 'when DISABLE_BANZAI_TIMEOUT set' do
+    context 'when GITLAB_DISABLE_MARKDOWN_TIMEOUT set' do
       it 'ignores MAX_PIPELINE_SECONDS' do
-        stub_env('DISABLE_BANZAI_TIMEOUT' => '1')
+        stub_env('GITLAB_DISABLE_MARKDOWN_TIMEOUT' => '1')
         allow_next_instance_of(described_class) do |instance|
           allow(instance).to receive(:result).and_return({ pipeline_timing: 1.1 })
         end
diff --git a/spec/lib/banzai/filter/concerns/timeout_filter_handler_spec.rb b/spec/lib/banzai/filter/concerns/timeout_filter_handler_spec.rb
index b02448d1a3bbc..f847f46565c32 100644
--- a/spec/lib/banzai/filter/concerns/timeout_filter_handler_spec.rb
+++ b/spec/lib/banzai/filter/concerns/timeout_filter_handler_spec.rb
@@ -39,9 +39,9 @@
     end
   end
 
-  context 'when DISABLE_BANZAI_TIMEOUT set' do
+  context 'when GITLAB_DISABLE_MARKDOWN_TIMEOUT set' do
     before do
-      stub_env('DISABLE_BANZAI_TIMEOUT' => '1')
+      stub_env('GITLAB_DISABLE_MARKDOWN_TIMEOUT' => '1')
       stub_const 'TimeoutTest', Class.new(HTML::Pipeline::Filter)
       TimeoutTest.class_eval { include Banzai::Filter::Concerns::TimeoutFilterHandler }
     end
diff --git a/spec/lib/gitlab/render_timeout_spec.rb b/spec/lib/gitlab/render_timeout_spec.rb
index c9ed825ddf316..7cf1f6e0aae4b 100644
--- a/spec/lib/gitlab/render_timeout_spec.rb
+++ b/spec/lib/gitlab/render_timeout_spec.rb
@@ -24,15 +24,15 @@ def expect_timeout(period)
   end
 
   describe 'banzai_timeout_disabled?' do
-    context 'when DISABLE_BANZAI_TIMEOUT set' do
+    context 'when GITLAB_DISABLE_MARKDOWN_TIMEOUT set' do
       it 'returns true' do
-        stub_env('DISABLE_BANZAI_TIMEOUT' => '1')
+        stub_env('GITLAB_DISABLE_MARKDOWN_TIMEOUT' => '1')
 
         expect(described_class.banzai_timeout_disabled?).to be_truthy
       end
     end
 
-    context 'when DISABLE_BANZAI_TIMEOUT is not set' do
+    context 'when GITLAB_DISABLE_MARKDOWN_TIMEOUT is not set' do
       it 'returns false' do
         expect(described_class.banzai_timeout_disabled?).to be_falsey
       end
-- 
GitLab