]> cat aescling's git repositories - mastodon.git/commitdiff
Do not share a single Redcarpet::Markdown object across threads
authorThibaut Girka <thib@sitedethib.com>
Thu, 23 May 2019 16:53:24 +0000 (18:53 +0200)
committerThibG <thib@sitedethib.com>
Thu, 23 May 2019 19:19:44 +0000 (21:19 +0200)
There are apparently thread-safety issues: https://github.com/vmg/redcarpet/pull/672

app/lib/formatter.rb

index a099ff7282270d628ad30464ced0f29b79b677dc..8a2828bbf10877fae1d045afc48e57e18099f4c6 100644 (file)
@@ -137,8 +137,6 @@ class Formatter
   private
 
   def markdown_formatter
-    return @markdown_formatter if defined?(@markdown_formatter)
-
     extensions = {
       autolink: true,
       no_intra_emphasis: true,
@@ -163,7 +161,7 @@ class Formatter
       link_attributes: { target: '_blank', rel: 'nofollow noopener' },
     })
 
-    @markdown_formatter = Redcarpet::Markdown.new(renderer, extensions)
+    Redcarpet::Markdown.new(renderer, extensions)
   end
 
   def html_entities