techAPJ
(Arpit Jalan)
2018 年 7 月 11 日午前 9:15
21
This is now done via:
committed 09:04AM - 11 Jul 18 UTC
We no longer carry post ids in memory and the rebake task can be resumed by running posts:rebake_uncooked_posts.
One caveat here is that the resume task will not rebake posts in reverse order (i.e. the sort order will be id ascending).
「いいね!」 6
clay
(Clay Heaton)
2018 年 7 月 17 日午後 6:33
22
techAPJ:
This is now done via:
So @techAPJ , if I need to trigger a rebake of every post on a Discourse install, is @pfaffman ’s method the proper one to use?
techAPJ
(Arpit Jalan)
2018 年 7 月 18 日午後 2:19
23
If you need to rebake all posts instantly then run bundle exec rake posts:rebake.
Post.update_all("baked_version = NULL") will rebake 100 posts (by default) every 15 minutes.
「いいね!」 4
clay
(Clay Heaton)
2018 年 7 月 20 日午後 12:50
24
Thanks, Arpit.
FYI, I encountered some performance issues with that approach, so I went with this, which alleviated the problem and resulted in the same outcome:
Post.in_batches.update_all('baked_version = NULL')
「いいね!」 6
ckshen
2018 年 9 月 6 日午前 8:17
26
@techAPJ I have a dummy question. Where do you run this command? After entering the app?
It tells me
bash: syntax error near unexpected token ''baked_version = NULL''
techAPJ
(Arpit Jalan)
2018 年 9 月 6 日午前 8:39
27
./launcher enter app
rails c
Post.in_batches.update_all('baked_version = NULL')
「いいね!」 6
Would the batch method be suitable for a large amount of rebakes?
2851000 / 27182220 ( 10.5%)
This our current process after starting it yesterday with the normal rebake command, it seems to tick about 1000 every 3 seconds. We are very close to the end of our import journey and testing, and I just wanted to make sure there was a more proper way to rebake a large site before we settled on this slower method.
「いいね!」 1
Isambard
(Isambard)
2024 年 5 月 31 日午前 6:42
29
この in_batches バージョンがどのように機能するか、誰か説明してもらえますか。おそらくバッチで再ベイクを実行するのでしょうが、上記の投稿では、デフォルトで100個ずつ15分ごとに再ベイクを実行すると述べられています。
200万件の再ベイクジョブがあり、最善の方法を模索しています。ジョブに緊急性はありませんが、長時間実行されるジョブによって通常の運用や管理運用(バックアップなど)が影響を受けないようにしたいと考えています。
Isambard
(Isambard)
2024 年 5 月 31 日午前 6:49
30
そして今、私はこの投稿を読みました:Rebaked all my posts, but what's it doing now? これは、再ベイクタスクが実際には再ベイクしているのではなく、再ベイクのためにマークしているだけであることを示しています(このマークはどのように行われるのですか?)。プロセスが非常に遅いため、投稿を再ベイクのためにマークするだけでこれほど時間がかかることを本当に信じがたいです。
より高速なサーバーに移行してください。
このプロセスがサイトに過負荷をかけないことに感謝してください。全体的な目的は、このプロセスがリソースを過剰に消費しないようにし、プロセス中にサイトの応答性を維持することです。
Isambard:
このマークはどのように行われますか?
ソースを参照することは常に良い考えです。
def rebake_posts(opts = {})
puts "Rebaking post markdown for '#{RailsMultisite::ConnectionManagement.current_db}'"
begin
disable_system_edit_notifications = SiteSetting.disable_system_edit_notifications
SiteSetting.disable_system_edit_notifications = true
total = Post.count
rebaked = 0
batch = 1000
Post.update_all("baked_version = NULL")
(0..(total - 1).abs).step(batch) do |i|
Post
.order(id: :desc)
.offset(i)
.limit(batch)
.each do |post|
rebake_post(post, opts)
print_status(rebaked += 1, total)
end
「いいね!」 2
Isambard
(Isambard)
2024 年 5 月 31 日午前 7:28
32
確かに、マーキングは非常に迅速に行われるはずです。そして、rebake_post はクッキングを呼び出すように見えます。これの一部または結果として、非同期タスクが発生しているのでしょうか?
はい、もちろんです。ジョブのセットを生成するジョブです。
Isambard
(Isambard)
2024 年 5 月 31 日午前 10:10
34
Robert:
より高速なサーバーに移行してください。
理想的な解決策ではありませんが、別の方法を見つけました!
独自の再ベーカーを作成しました。これは1000倍高速なので、1ヶ月かかる代わりに数分で済みます。
データベース挿入の直前に再ベークするので、再ベークのコストはDB挿入時間内に消えます。
「いいね!」 1
merefield
(Robert)
2024 年 5 月 31 日午前 10:27
35
あ、わかりました。あなたのコンテキストは知りませんでした。
はい、これは本番環境向けに書かれています。
「いいね!」 1
Isambard
(Isambard)
2024 年 7 月 10 日午後 11:56
37
インポートされたすべての投稿をスキャンして、どのようなマークアップ/スマイリーが含まれているかを見つけるプログラムを作成しました。次に、生の投稿をHTMLにベイクしてデータベースを直接更新する別のプログラムを作成しました。