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
ember-concurrency: an experience report
Search
Reg Braithwaite
June 05, 2017
Programming
1
150
ember-concurrency: an experience report
An informal talk given at the EmberTO meetup in June, 2017
Reg Braithwaite
June 05, 2017
Tweet
Share
More Decks by Reg Braithwaite
See All by Reg Braithwaite
Courage
raganwald
0
130
Waste in Software Development
raganwald
0
190
First-Class Commands, the 2017 Edition
raganwald
1
210
Optimism and the Growth Mindset
raganwald
0
310
Optimism II
raganwald
0
420
Optimism
raganwald
0
2k
First-Class Commands: an unexpectedly fertile design pattern
raganwald
4
3k
JavaScript Combinators, the “six” edition
raganwald
8
1.4k
Duck Typing, Compatibility, and the Adaptor Pattern
raganwald
7
11k
Other Decks in Programming
See All in Programming
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
110
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
140
PC-6001でPSG曲を鳴らすまでを全部NetBSD上の Makefile に押し込んでみた / osc2025hiroshima
tsutsui
0
210
CSC307 Lecture 03
javiergs
PRO
1
480
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 2
philipschwarz
PRO
0
140
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.4k
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
300
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
180
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
340
SQL Server 2025 LT
odashinsuke
0
160
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
140
CSC307 Lecture 05
javiergs
PRO
0
470
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
110
Amusing Abliteration
ianozsvald
0
86
AI: The stuff that nobody shows you
jnunemaker
PRO
2
170
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
98
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.2k
Visualization
eitanlees
150
16k
How Software Deployment tools have changed in the past 20 years
geshan
0
31k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
290
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
270
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
115
100k
Transcript
ember-concurrency "an experience report" Reginald @raganwald Braithwaite, PagerDuty Inc.
ember-concurrency ember-concurrency is an Ember Addon that makes it easy
to write concise, robust, and beautiful asynchronous code. --http://ember-concurrency.com/ Reginald @raganwald Braithwaite, PagerDuty Inc.
tasks and instances aTask = task(function * () { const
{ geolocation, store } = this.get(...); const coords = yield geolocation.getCoords(); const result = yield store.getNearbyStores(coords); this.set('result', result); }); anInstance = someTask.perform(); Reginald @raganwald Braithwaite, PagerDuty Inc.
problems ember-concurrency solves, easily Reginald @raganwald Braithwaite, PagerDuty Inc.
mashing the "submit" button on an update Reginald @raganwald Braithwaite,
PagerDuty Inc.
! Reginald @raganwald Braithwaite, PagerDuty Inc.
concurrency protocols task(function * () { // ... }).drop() (ember-concurrency
calls these "modifiers") Reginald @raganwald Braithwaite, PagerDuty Inc.
! Reginald @raganwald Braithwaite, PagerDuty Inc.
displaying a loading spinner Reginald @raganwald Braithwaite, PagerDuty Inc.
! this.set('isLoading', true); this.xhr = fetch(id).then( success => { this.set('isLoading',
false); // ... }, failure => { this.set('isLoading', false); // ... }); Reginald @raganwald Braithwaite, PagerDuty Inc.
! isLoading: reads('fetchTask.isRunning') Reginald @raganwald Braithwaite, PagerDuty Inc.
using ember-concurrency to solve other problems Reginald @raganwald Braithwaite, PagerDuty
Inc.
chunking updates to our api Reginald @raganwald Braithwaite, PagerDuty Inc.
progress const chunks = _.chunk(incidents, CHUNK_SIZE); let done = 0;
this.set('done', done); for (const theseIncidents of chunks) { yield this.resolve(theseIncidents); done = done + theseIncidents.length); this.set('done', done); } Reginald @raganwald Braithwaite, PagerDuty Inc.
Reginald @raganwald Braithwaite, PagerDuty Inc.
cancellation aTask.cancelAll(); anInstance.cancel(); Reginald @raganwald Braithwaite, PagerDuty Inc.
a bigger challenge Reginald @raganwald Braithwaite, PagerDuty Inc.
In JavaScript, AJAX requests happen concurrently. Reginald @raganwald Braithwaite, PagerDuty
Inc.
Reginald @raganwald Braithwaite, PagerDuty Inc.
⛈ websocket ping: [-----------------] submit update: [-----------] Reginald @raganwald Braithwaite,
PagerDuty Inc.
☀ Reginald @raganwald Braithwaite, PagerDuty Inc.
sharing one task task(function * (promissoryThunk) { let result; yield
promissoryThunk().then(value => { result = value; }); return result; }).enqueue() Reginald @raganwald Braithwaite, PagerDuty Inc.
serialized results websocket ping: [--------] submit update: [-------] Reginald @raganwald
Braithwaite, PagerDuty Inc.
⁉ Reginald @raganwald Braithwaite, PagerDuty Inc.
task groups tasks: taskGroup().enqueue(), handlePing: task(function * () { //
... }).group('tasks'), submitUpdate: task(function * () { // ... }).group('tasks') Reginald @raganwald Braithwaite, PagerDuty Inc.
ember-concurrency conclusion Reginald @raganwald Braithwaite, PagerDuty Inc.
Simple things are easy, complex things are possible. Reginald @raganwald
Braithwaite, PagerDuty Inc.
Reginald @raganwald Braithwaite, PagerDuty Inc.