Commit 76871355 authored by Peter Leitzen's avatar Peter Leitzen

Make constant more visible at module level

We will add more constants to this module soon so
we have them at one place and not scattered.
parent 8b5352b5
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
module StatusPage module StatusPage
class PublishBaseService class PublishBaseService
JSON_MAX_SIZE = 1.megabyte
def initialize(project:, storage_client:, serializer:) def initialize(project:, storage_client:, serializer:)
@project = project @project = project
@storage_client = storage_client @storage_client = storage_client
...@@ -40,7 +38,9 @@ module StatusPage ...@@ -40,7 +38,9 @@ module StatusPage
end end
def limit_exceeded?(json) def limit_exceeded?(json)
!Gitlab::Utils::DeepSize.new(json, max_size: JSON_MAX_SIZE).valid? !Gitlab::Utils::DeepSize
.new(json, max_size: Storage::JSON_MAX_SIZE)
.valid?
end end
def error(message, payload = {}) def error(message, payload = {})
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
module StatusPage module StatusPage
module Storage module Storage
# Size limit of the generated JSON uploaded to CDN.
JSON_MAX_SIZE = 1.megabyte
# Limit the amount of the recent incidents in the JSON list # Limit the amount of the recent incidents in the JSON list
MAX_RECENT_INCIDENTS = 20 MAX_RECENT_INCIDENTS = 20
# Limit the amount of comments per incident # Limit the amount of comments per incident
......
...@@ -48,7 +48,7 @@ RSpec.shared_examples 'publish incidents' do ...@@ -48,7 +48,7 @@ RSpec.shared_examples 'publish incidents' do
end end
context 'when limits exceeded' do context 'when limits exceeded' do
let(:too_big) { 'a' * StatusPage::PublishBaseService::JSON_MAX_SIZE } let(:too_big) { 'a' * StatusPage::Storage::JSON_MAX_SIZE }
before do before do
if content.is_a?(Array) if content.is_a?(Array)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment