I have a saga which is listening to an action. And when this action is dispatched it performs a blocking call.
The problem is that a lot of actions (same actions) are dispatched in the same time and my saga can't take all the actions. But I need to process each action synchronously.
I know this is a known problem in redux-saga documentation : My Saga is missing dispatched actions
But the fact is that I can't use a fork since I really need the previous call to be over before processing a new one.
Here is my code :
export function* readProducts() {
while (true) {
const {
payload: { tags },
} = yield take(RFID__ADD_PRODUCT);
// sequential add of each item
for (const tag of tags) {
yield call(addProductViaRfid, tag);
}
}
}
Does anyone have a solution ?
channel
andbuffers
to hold incoming requests. Something like this,const actionChannel = yield call(channel, buffers.expanding());
I've dealt a quite similar situation like yours but mine was with uploading a number of blocks to server. I thought this would be the same approach. – Spinning