Skip to content

Instantly share code, notes, and snippets.

@reime005
Last active September 14, 2019 11:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
/* src/store/rootSaga.js */
//... imports
function* handleRequest(chan) {
while (true) {
const action = yield take(chan);
yield call(sendMediaSaga, action);
}
}
function* mediaQueueSaga() {
// create a channel to queue incoming requests
const chan = yield call(channel);
// create 1 worker 'threads'
for (let i = 0; i < 1; i++) {
yield fork(handleRequest, chan);
}
while (true) {
const action = yield take(SEND_MEDIA_SAGA_ACTION);
yield put(chan, action);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment