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
140
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.5k
Duck Typing, Compatibility, and the Adaptor Pattern
raganwald
7
11k
Other Decks in Programming
See All in Programming
Vibe codingでおすすめの言語と開発手法
uyuki234
0
210
AI時代の認知負荷との向き合い方
optfit
0
130
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
670
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
280
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
110
TerraformとStrands AgentsでAmazon Bedrock AgentCoreのSSO認証付きエージェントを量産しよう!
neruneruo
4
2.7k
AIエージェントの設計で注意するべきポイント6選
har1101
7
3.4k
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
5.9k
CSC307 Lecture 07
javiergs
PRO
0
540
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
630
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
370
ELYZA_Findy AI Engineering Summit登壇資料_AIコーディング時代に「ちゃんと」やること_toB LLMプロダクト開発舞台裏_20251216
elyza
2
1.4k
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
130
A Tale of Four Properties
chriscoyier
162
24k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
270
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.9k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
The Pragmatic Product Professional
lauravandoore
37
7.1k
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
0
1.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
53
Building Adaptive Systems
keathley
44
2.9k
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.