Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Dive into MaintenanceTasks
Search
hatsu
August 01, 2024
Programming
1
110
Dive into MaintenanceTasks
hatsu
August 01, 2024
Tweet
Share
More Decks by hatsu
See All by hatsu
introduction_scriptor_gem.pdf
hatsu38
1
83
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
24
15k
Just a Rails Patch Update
hatsu38
2
570
GitHub Actions is Fun
hatsu38
1
130
Other Decks in Programming
See All in Programming
Package Traits
ikesyo
1
210
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
390
ecspresso, ecschedule, lambroll を PipeCDプラグインとして動かしてみた (プロトタイプ) / Running ecspresso, ecschedule, and lambroll as PipeCD Plugins (prototype)
tkikuc
2
1.8k
ゼロからの、レトロゲームエンジンの作り方
tokujiros
3
1k
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
1.2k
PHPカンファレンス 2024|共創を加速するための若手の技術挑戦
weddingpark
0
140
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
7.7k
asdf-ecspresso作って 友達が増えた話 / Fujiwara Tech Conference 2025
koluku
0
1.4k
rails newと同時に型を書く
aki19035vc
5
710
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
1.1k
快速入門可觀測性
blueswen
0
500
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
210
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
A Tale of Four Properties
chriscoyier
157
23k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Gamification - CAS2011
davidbonilla
80
5.1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
BBQ
matthewcrist
85
9.4k
Speed Design
sergeychernyshev
25
730
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Docker and Python
trallard
43
3.2k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Transcript
Dive into MaintenanceTasks omotesando.rb#100, roppongirb#21 2024/08/01 @hatsu_38
ࣗݾհ • Rubyྺ 5 = ΤϯδχΞྺ • SHE Inc. •
React.js / TypeScript / GitHub Actions • Ruby͕Ұ൪͖
͓அΓɻ ίʔυͷղઆͱ͔ೖΕͨΒεϥΠυ͕ 81ຕʹͳͬͯ5ͰऴΘΔΘ͚͕ͳ͍ ͷͰޙۦ͚&ં͍͖ͬͯ·͢🏃
ٕज़ελοΫ • Backend: Ruby, Ruby on Rails, GraphQL, Sidekiq •
Frontend: React.js, TypeScript, Next.js • CI: GitHub Actions • Infrastructure: Kubernetes
Initial commit͔Β7…
Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle exec
rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β…
ຊ൪αʔόʔʹೖΔͷා͍🙅 Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle
exec rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β…
ຊ൪αʔόʔͰखಈͰίϚϯυ࣮ߦා͍🙅 Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle
exec rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β… ຊ൪αʔόʔʹೖΔͷා͍🙅
ຊ൪αʔόʔͰखಈͰίϚϯυ࣮ߦා͍🙅 Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle
exec rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β… ຊ൪αʔόʔʹೖΔͷා͍🙅 ࢝Ί͔Β࣮ߦ͢Δͷ͕͔͔࣌ؒΔ🙅
Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle exec
rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β… ຊ൪αʔόʔͰखಈͰίϚϯυ࣮ߦා͍🙅 ຊ൪αʔόʔʹೖΔͷා͍🙅 ࢝Ί͔Β࣮ߦ͢Δͷ͕͔͔࣌ؒΔ🙅
MaintenanceTasks͍࢝Ίͨ🚀
MaintenanceTasks is Կ
MaintenanceTasks is Կ • UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ •
Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ
MaintenanceTasks is Կ • UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ •
Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ
• UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ • Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ MaintenanceTasks is
Կ
• UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ • Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ MaintenanceTasks is
Կ
• UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ • Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ MaintenanceTasks is
Կ
MaintenanceTasksͷ͍ํ
MaintenanceTasksͷ͍ํ Collectionʹॲཧ͍ͨ͠σʔλΛఆٛ(ActiveRecord::Relation CSV)
MaintenanceTasksͷ͍ํ processʹ֤σʔλͷॲཧ͢Δ༰Λఆٛ Collectionʹॲཧ͍ͨ͠σʔλΛఆٛ(ActiveRecord::Relation CSV)
MaintenanceTasksͷ͍ํ bin/rails generate maintenance_tasks:install
MaintenanceTasksͷ͍ํ ͲͷTaskΛ࣮ߦ͍ͯ͠Δ͔ ։࢝࣌ࠁ ऴྃ࣌ࠁ ࣮ߦ࣌ؒ ࣮ߦ݅ ࣮ߦ(༧ఆ)݅ SecureRandom .uuid ࠶։ॴͷIndex(ID)
࣮ߦεςʔλε(Enum) enqueued / running / succeeded / cancelling / cancelled / interrupted / pausing / paused / errored bin/rails generate maintenance_tasks:install ΤϥʔͷClass ΤϥʔMessage Backtrace
ɾαʔόʔʹೖΒͣʹJobΛ࣮ߦͰ͖Δ✨ ɾMaintenanceTaskͳΒ్தͰ࠶։Ͱ͖Δ✨
ศརʂ✨
MaintenanceTasks࣮ߦʂ🚀
JobʹΤϥʔൃੜʂ💥
్த͔Β࠶։✨
Ͳ͏࣮ͬͯ͞ΕͯΔ͔ݟͯΈΔ🔍 MaintenanceTasks & JobIteration
MaintenanceTaskͷςʔϒϧ ͲͷTaskΛ࣮ߦ͍ͯ͠Δ͔ ։࢝࣌ࠁ ऴྃ࣌ࠁ ࣮ߦ࣌ؒ ࣮ߦ݅ ࣮ߦ(༧ఆ)݅ SecureRandom .uuid ࠶։ॴͷIndex(ID)
࣮ߦεςʔλε(Enum) enqueued / running / succeeded / cancelling / cancelled / interrupted / pausing / paused / errored bin/rails generate maintenance_tasks:install ΤϥʔͷClass ΤϥʔMessage Backtrace
CursorͷอଘλΠϛϯάΛ୳͢🔬
Job͕Enqueue͞ΕΔ·ͰΛ ͬͯΈΔ🏃
Job͕enqueue͞ΕΔ·Ͱ(ͬ͘͟Γ) RunϘλϯ show.html.erb Runner.run(*) RunsController#create 1. DBʹRunϨίʔυ࡞ 2. Jobͷenqueue Runner#run
show.html.erb
show.html.erb
show.html.erb MaintenanceTasks::RunsController#create
MaintenanceTasks::RunsController#create
MaintenanceTasks::RunsController#create MaintenanceTasks::Runnerͷݺͼग़͠
MaintenanceTasks::Runner#run
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew MaintenanceTasks::TaskJob.new(run) = ActiveJob::Base.new(run)
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew MaintenanceTasks::TaskJob.new(run) = ActiveJob::Base.new(run) MaintenanceTasks::Run modelͷstatusΛenqueuedʹมߋͯ͠อଘ
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew MaintenanceTasks::TaskJob.new(run) = ActiveJob::Base.new(run) enqueue͢Δ MaintenanceTasks::Run modelͷstatusΛenqueuedʹมߋͯ͠อଘ
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew MaintenanceTasks::TaskJob.new(run) = ActiveJob::Base.new(run) enqueue͢Δ MaintenanceTasks::Run modelͷstatusΛenqueuedʹมߋͯ͠อଘ Job͕enqueue͞Εͨʂ
Enqueue͞Εͨ͋ͱͷྲྀΕΛݟΔ🔍
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D ActiveJobͰఆٛ͞Ε͍ͯΔCallback ActiveJobͰఆٛ͞Ε͍ͯΔCallback
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D job-iteration gem͕ఆ͍ٛͯ͠ΔCallback sidekiq v7.3ʹsidekiq-iteration gemͰࣅͨϝιου͕Ճ͞Εͨ
ͦΕͧΕͷStepͰ ͬͯΔ͜ͱΛௐࠪ🛠
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2 ରσʔλͷྻ࡞
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2 1ͭ1ͭσʔλΛॲཧ(Processϝιουͷ࣮ߦ) ରσʔλͷྻ࡞
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2 shutdown callbackͷ࣮ߦ ରσʔλͷྻ࡞ 1ͭ1ͭσʔλΛॲཧ(Processϝιουͷ࣮ߦ)
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2 shutdown callbackͷ࣮ߦ complete callbackͷ࣮ߦ ରσʔλͷྻ࡞ 1ͭ1ͭσʔλΛॲཧ(Processϝιουͷ࣮ߦ)
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. ॲཧ͖͢σʔλͷྻΛ࡞ 2. on_startϝιου࣮ߦ 3. RunϞσϧͷσʔλͷ։࢝࣌ࠁͱॲཧ༧ఆ݅Λߋ৽ 1. update!(started_at: Time.now, tick_total: count)
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. ॲཧ͖͢σʔλͷྻΛ࡞ 2. on_startϝιου࣮ߦ 3. RunϞσϧͷσʔλͷ։࢝࣌ࠁͱॲཧ༧ఆ݅Λߋ৽ 1. update!(started_at: Time.now, tick_total: count) 3
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. ॲཧ͖͢σʔλͷྻΛ࡞ 2. on_startϝιου࣮ߦ 3. RunϞσϧͷσʔλͷ։࢝࣌ࠁͱॲཧ༧ఆ݅Λߋ৽ 1. update!(started_at: Time.now, tick_total: count) 3 3
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTaskʹࣗͰॻ͍ͨdef process͕࣮ߦ͞ΕΔ 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTaskʹࣗͰॻ͍ͨdef process͕࣮ߦ͞ΕΔ 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTaskʹࣗͰॻ͍ͨdef process͕࣮ߦ͞ΕΔ 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 1 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTaskʹࣗͰॻ͍ͨdef process͕࣮ߦ͞ΕΔ 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 1 1 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ 1 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1 3 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1 3 3 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. εςʔλεʹcancelled / paused / interrupted ͱcursorૠೖ(อଘ·ͩ) 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1 1. εςʔλεʹcancelled / paused / interruptedͷૠೖ(อଘ·ͩ) 2. Cursorૠೖ(อଘ·ͩ) 3. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1 1 1. εςʔλεʹcancelled / paused / interruptedͷૠೖ(อଘ·ͩ) 2. Cursorૠೖ(อଘ·ͩ) 3. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. εςʔλεʹcancelled / paused / interruptedͷૠೖ(อଘ·ͩ) 2. Cursorૠೖ(อଘ·ͩ) 3. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 1 1 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1 1 3 2 1. εςʔλεʹcancelled / paused / interruptedͷૠೖ(อଘ·ͩ) 2. Cursorૠೖ(อଘ·ͩ) 3. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. statusʹsucceededΛɺended_atʹTime.nowʹૠೖ(อଘ·ͩ)
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. statusʹsucceededΛɺended_atʹTime.nowʹૠೖ(อଘ·ͩ) 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ૠೖ͍ͯͨ͠cursorstatusended_atΛอଘ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ૠೖ͍ͯͨ͠cursorstatusended_atΛอଘ 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ૠೖ͍ͯͨ͠cursorstatusended_atΛอଘ 1 1
on_error after_performͰ ࠶։ॴΛه͍ͯͨ͠✨ (Ωϟϯηϧதஅͨ͠ͱ͖ಉ͡)
·ͱΊ • MaintenanceTasksศར • UI্ͰJob࣮ߦͰ͖Δ͠ɺجຊతʹ్தͰதஅɾ࠶։Ͱ͖Δ • SIGKILLͷ࣌࠶։Ͱ͖ͳ͍ɻSIGTERMͱ͔ͳΒ࠶։Ͱ͖Δ • Sidekiq v7.3ͰࣅͨΑ͏ͳػೳ͕ೖͬͨ
• RunsςʔϒϧͰͳ͘ɺredisͰཧͯ͠Δ