Change regexp timeout feature to be opt-in

This commit is contained in:
Claire 2024-09-30 11:29:40 +02:00
parent 431b382563
commit fbbd4357f5

View file

@ -1,4 +1,3 @@
# frozen_string_literal: true
# 2s is a fairly high default, but that should account for slow servers under load
Regexp.timeout = ENV.fetch('REGEXP_TIMEOUT', 2).to_f if Regexp.respond_to?(:timeout=)
Regexp.timeout = ENV['REGEXP_TIMEOUT'].to_f if Regexp.respond_to?(:timeout=) && ENV['REGEXP_TIMEOUT']