$30 off During Our Annual Pro Sale. View Details »

Dive into MaintenanceTasks

hatsu
August 01, 2024

Dive into MaintenanceTasks

hatsu

August 01, 2024
Tweet

More Decks by hatsu

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ • Rubyྺ 5೥ = ΤϯδχΞྺ • SHE Inc. •

    React.js / TypeScript / GitHub Actions • Ruby͕Ұ൪޷͖
  2. ٕज़ελοΫ • Backend: Ruby, Ruby on Rails, GraphQL, Sidekiq •

    Frontend: React.js, TypeScript, Next.js • CI: GitHub Actions • Infrastructure: Kubernetes
  3. ຊ൪αʔόʔͰखಈͰίϚϯυ࣮ߦ΋ා͍🙅 Rake taskͷ࣮ߦํ๏͸ 1. podʹkubectl exec … bashͰೖΔ 2. bundle

    exec rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β… ຊ൪αʔόʔʹೖΔͷා͍🙅
  4. ຊ൪αʔόʔͰखಈͰίϚϯυ࣮ߦ΋ා͍🙅 Rake taskͷ࣮ߦํ๏͸ 1. podʹkubectl exec … bashͰೖΔ 2. bundle

    exec rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β… ຊ൪αʔόʔʹೖΔͷා͍🙅 ࢝Ί͔Β࣮ߦ͢Δͷ͕͔͔࣌ؒΔ🙅
  5. Rake taskͷ࣮ߦํ๏͸ 1. podʹkubectl exec … bashͰೖΔ 2. bundle exec

    rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β… ຊ൪αʔόʔͰखಈͰίϚϯυ࣮ߦ΋ා͍🙅 ຊ൪αʔόʔʹೖΔͷා͍🙅 ࢝Ί͔Β࣮ߦ͢Δͷ͕͔͔࣌ؒΔ🙅
  6. 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
  7. 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
  8. 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͕ऴΘͬͨ௚ޙʹ࣮ߦ͞ΕΔɻ
  9. 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
  10. 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Ͱࣅͨϝιου͕௥Ճ͞Εͨ
  11. 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͕࣮ߦ͞ΕΔ
  12. 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͕࣮ߦ͞ΕΔ
  13. 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
  14. 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
  15. 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
  16. 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 ର৅σʔλͷ഑ྻ࡞੒
  17. 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ϝιουͷ࣮ߦ) ର৅σʔλͷ഑ྻ࡞੒
  18. 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ϝιουͷ࣮ߦ)
  19. 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ϝιουͷ࣮ߦ)
  20. 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)
  21. 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
  22. 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
  23. 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. ݱࡏͷॲཧ݅਺ͱܦա࣌ؒΛߋ৽
  24. 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
  25. 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
  26. 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
  27. 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. ΤϥʔͷClass΍Backtrace΍ErrorϝοηʔδΛrunσʔλʹอଘ
  28. 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. ΤϥʔͷClass΍Backtrace΍ErrorϝοηʔδΛrunσʔλʹอଘ
  29. 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. ΤϥʔͷClass΍Backtrace΍ErrorϝοηʔδΛrunσʔλʹอଘ 1 2
  30. 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. ΤϥʔͷClass΍Backtrace΍ErrorϝοηʔδΛrunσʔλʹอଘ 2
  31. 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. ΤϥʔͷClass΍Backtrace΍ErrorϝοηʔδΛrunσʔλʹอଘ 2
  32. 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. ݱࡏͷॲཧ݅਺ͱܦա࣌ؒΛߋ৽
  33. 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. ݱࡏͷॲཧ݅਺ͱܦա࣌ؒΛߋ৽
  34. 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. ݱࡏͷॲཧ݅਺ͱܦա࣌ؒΛߋ৽
  35. 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
  36. 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. ݱࡏͷॲཧ݅਺ͱܦա࣌ؒΛߋ৽
  37. 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ʹૠೖ(อଘ͸·ͩ)
  38. 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
  39. 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. ૠೖ͍ͯͨ͠cursor΍status΍ended_atΛอଘ
  40. 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. ૠೖ͍ͯͨ͠cursor΍status΍ended_atΛอଘ 1
  41. 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. ૠೖ͍ͯͨ͠cursor΍status΍ended_atΛอଘ 1 1