Module: Banzai::Filter::Concerns::TimeoutFilterHandler

Constant Summary collapse

RENDER_TIMEOUT =
2.seconds
SANITIZATION_RENDER_TIMEOUT =
TODO

Seeing several complaints about rendering being too complex.

gitlab.com/gitlab-org/gitlab/-/issues/469683 The default 2 seconds seems to be too aggressive at the moment. It can also depend in the hardware that we’re running on. So let’s make it 5. Currently the overall pipeline timeout (pipeline_timing_check.rb) is set to 5.

5.seconds
COMPLEX_MARKDOWN_MESSAGE =
"<p>Rendering aborted due to complexity issues. If this is valid markdown, please feel free to open an issue\nand attach the original markdown to the issue.</p>\n"

Instance Method Summary collapse

Instance Method Details

#callObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/banzai/filter/concerns/timeout_filter_handler.rb', line 34

def call
  return super if Gitlab::RenderTimeout.banzai_timeout_disabled? || context[:disable_banzai_timeout]

  Gitlab::RenderTimeout.timeout(foreground: render_timeout, background: render_timeout) { super }
rescue Timeout::Error => e
  class_name = self.class.name.demodulize
  Gitlab::ErrorTracking.track_exception(e, project_id: context[:project]&.id, group_id: context[:group]&.id,
    class_name: class_name)

  # we've timed out, but some work may have already been completed,
  # so return what we can
  returned_timeout_value
end