Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/just-paja/redux-saga-job-queue
Queue same redux saga tasks and run them in a batch
https://github.com/just-paja/redux-saga-job-queue
Last synced: 13 days ago
JSON representation
Queue same redux saga tasks and run them in a batch
- Host: GitHub
- URL: https://github.com/just-paja/redux-saga-job-queue
- Owner: just-paja
- License: mit
- Created: 2018-09-01T16:10:01.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T15:18:13.000Z (almost 2 years ago)
- Last Synced: 2024-10-05T16:20:41.357Z (about 1 month ago)
- Language: JavaScript
- Size: 957 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# redux-saga-job-queue
Queue same redux saga tasks and run them in a batch.
## Install
Library is written for ES modules
```javascript
npm install redux-saga-job-queue
```## Usage
Lets assume that you already have it installed. First we import it.
```javascript
import { createInteractiveQueue } from 'redux-saga-job-queue';
```Second, we need to define a task that is going to be called for each item.
```javascript
function downloadFile({ payload }) {
const payload = yield call(fetch, payload);
yield put({
type: 'FILE_READY',
payload,
});
}
```Run the jobs in three parallel threads
```javascript
function* downloadFiles(files) {
const queue = createInteractiveQueue({
items: files,
jobFactory: downloadFile,
concurrency: 3,
});
yield call(queue.run);
}
```