mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 12:24:55 +00:00
fix onebox exception, if oneboxes fail on save we log a warning to the log
This commit is contained in:
parent
d43bd55e5b
commit
f4d833da27
@ -9,11 +9,18 @@ class PostAnalyzer
|
|||||||
def cook(*args)
|
def cook(*args)
|
||||||
cooked = PrettyText.cook(*args)
|
cooked = PrettyText.cook(*args)
|
||||||
|
|
||||||
# If we have any of the oneboxes in the cache, throw them in right away, don't
|
# cook all oneboxes, in the past we used to defer this
|
||||||
# wait for the post processor.
|
# for some reason we decided to do this inline now
|
||||||
|
# TODO: discuss on http://meta.discourse.org what the correct thing is to do
|
||||||
|
# keep in mind some oneboxes may take a long time to build
|
||||||
result = Oneboxer.apply(cooked) do |url, elem|
|
result = Oneboxer.apply(cooked) do |url, elem|
|
||||||
Oneboxer.invalidate(url) if args.last[:invalidate_oneboxes]
|
Oneboxer.invalidate(url) if args.last[:invalidate_oneboxes]
|
||||||
|
begin
|
||||||
Oneboxer.onebox url
|
Oneboxer.onebox url
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.warn("Failed to cook onebox: #{e.message} #{e.backtrace}")
|
||||||
|
nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cooked = result.to_html if result.changed?
|
cooked = result.to_html if result.changed?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user