Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
resque-scheduler
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Fumiaki MATSUSHIMA
November 30, 2016
Programming
240
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
resque-scheduler
Shinjuku.rb #43 発表資料
https://shinjukurb.connpass.com/event/44524/
Fumiaki MATSUSHIMA
November 30, 2016
Transcript
35 slides
(株)永和システムマネジメント @mtsmfm 松島 史秋 resque-scheduler
松島 史秋 GitHub, Twitter @mtsmfm
ポケモン S/M まっちまー フレコ 1907-9185-9222
None
resque- scheduler
https://github.com/resque/resque-scheduler
大きく2つの 機能
- Delay - Schedule
- Delay - 10分後に実行 - Schedule - cron
resque 単体だと できない
ActiveJob
http://edgeguides.rubyonrails.org/active_job_basics.html#enqueue-the-job
ActiveJob が やってくれたり してないかな
Emoji provided free by Emoji One
https://github.com/mtsmfm/ resque-scheduler-example
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque- scheduler.rb#L4
挙動が違う
https://github.com/jmettraux/rufus-scheduler/blob/master/lib/rufus- scheduler.rb
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/tasks.rb#L17-L18
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/cli.rb#L117
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L59-L70
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/locking.rb#L65-L67
Lock
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/locking.rb#L3-L50
- master プロセスが落ちたときに複数回 enqueue されないための機構 - Redis の SETNX を使っている
- Delayed job は SETNX で単純な十分 - Scheduled job (cron っぽい方) は頻繁に master が変わると、マシンの時間がずれて いる場合に厳しい - (デフォルトだと) 3 分ごとに lock をとる - 2 回走ってもいいときや時間の同期がきっち りされているなら短くするとよい
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L59-L70
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L181-L190
Schedule job は?
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/locking.rb#L3-L50
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/locking.rb#L28-L30
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L49-L53
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L89-L104
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L124-L163
学び
- 概要のわかる ドキュメント大事 - resque-scheduler は 多重実行されるくらいなら job が失われた方がいいという方 針
- Lock 機構難しい
More Decks by Fumiaki MATSUSHIMA
See All by Fumiaki MATSUSHIMA
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
150
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
260
Learning from performance improvements on GraphQL Ruby
mtsmfm
1
1.5k
Ruby で作る Ruby (物理)
mtsmfm
1
330
GraphQL Ruby benchmark
mtsmfm
1
940
タイムアウトにご用心 / Timeout might break application state
mtsmfm
6
2.7k
Build REST API with GraphQL Ruby
mtsmfm
0
420
GraphQL Ruby をちょっとだけ速くした / Make graphql-ruby faster a bit
mtsmfm
1
820
Gaming PC on GCP
mtsmfm
0
850
Other Decks in Programming
See All in Programming
眠らない開発チームの作り方
biwakonbu
0
180
Spec-driven Development with AI
simas
PRO
0
2.3k
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
370
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
220
LLM 101
dalinaum
0
560
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
220
AIコーディングをセッションで終わらせない: PHPライブラリ開発におけるコンテキスト承継設計
ickx
0
120
ビジネスロジックを堅牢に~Scala 3のドメインプリミティブ~
j5ik2o
0
240
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
200
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
260
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1.1k
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.6k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
250
Building Adaptive Systems
keathley
44
3.3k
A designer walks into a library…
pauljervisheath
211
25k
RailsConf 2023
tenderlove
30
1.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
860
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
540
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
890
Statistics for Hackers
jakevdp
799
230k
The World Runs on Bad Software
bkeepers
PRO
72
12k