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
resque-scheduler
Search
Fumiaki MATSUSHIMA
November 30, 2016
Programming
0
180
resque-scheduler
Shinjuku.rb #43 発表資料
https://shinjukurb.connpass.com/event/44524/
Fumiaki MATSUSHIMA
November 30, 2016
Tweet
Share
More Decks by Fumiaki MATSUSHIMA
See All by Fumiaki MATSUSHIMA
Learning from performance improvements on GraphQL Ruby
mtsmfm
1
1.1k
Ruby で作る Ruby (物理)
mtsmfm
1
210
GraphQL Ruby benchmark
mtsmfm
1
820
タイムアウトにご用心 / Timeout might break application state
mtsmfm
6
2.5k
Build REST API with GraphQL Ruby
mtsmfm
0
330
GraphQL Ruby をちょっとだけ速くした / Make graphql-ruby faster a bit
mtsmfm
1
730
Gaming PC on GCP
mtsmfm
0
730
How to introduce GraphQL to an existing React-Redux application
mtsmfm
1
250
Canary release in StudySapuri
mtsmfm
0
3.1k
Other Decks in Programming
See All in Programming
ふつうの技術スタックでアート作品を作ってみる
akira888
1
1.1k
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
240
Git Sync を超える!OSS で実現する CDK Pull 型デプロイ / Deploying CDK with PipeCD in Pull-style
tkikuc
3
160
AI Agent 時代のソフトウェア開発を支える AWS Cloud Development Kit (CDK)
konokenj
4
550
TypeScriptでDXを上げろ! Hono編
yusukebe
3
480
Hack Claude Code with Claude Code
choplin
5
2.4k
猫と暮らす Google Nest Cam生活🐈 / WebRTC with Google Nest Cam
yutailang0119
0
160
ご注文の差分はこちらですか? 〜 AWS CDK のいろいろな差分検出と安全なデプロイ
konokenj
3
380
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
2
940
AI コーディングエージェントの時代へ:JetBrains が描く開発の未来
masaruhr
1
200
RailsGirls IZUMO スポンサーLT
16bitidol
0
190
Deep Dive into ~/.claude/projects
hiragram
14
8.4k
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.8k
4 Signs Your Business is Dying
shpigford
184
22k
Statistics for Hackers
jakevdp
799
220k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
Unsuck your backbone
ammeep
671
58k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
Automating Front-end Workflow
addyosmani
1370
200k
What's in a price? How to price your products and services
michaelherold
246
12k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
6
320
Transcript
(株)永和システムマネジメント @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 機構難しい