mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 19:37:55 +08:00
FIX: only attempt old rebakes a maximum of 3 times
This commit is contained in:
parent
b205910faa
commit
0c834515a9
|
@ -480,6 +480,16 @@ class Post < ActiveRecord::Base
|
||||||
p.rebake!
|
p.rebake!
|
||||||
rescue => e
|
rescue => e
|
||||||
problems << { post: p, ex: e }
|
problems << { post: p, ex: e }
|
||||||
|
|
||||||
|
attempts = p.custom_fields["rebake_attempts"].to_i
|
||||||
|
if attempts > 3
|
||||||
|
p.update_columns(baked_version: BAKED_VERSION)
|
||||||
|
Discourse.warn_exception(e, "Can not rebake post# #{p.id} after 3 attempts, giving up")
|
||||||
|
else
|
||||||
|
p.custom_fields["rebake_attempts"] = attempts + 1
|
||||||
|
p.save_custom_fields
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
problems
|
problems
|
||||||
|
|
Loading…
Reference in New Issue
Block a user