Well, this can really be solved in numerous ways.
- with passing your map into your worker by reference, so it can reset in the end (mutation making this solution not elegant)
function* customTake(pattern, worker, ...args) {
let currentTasks = {};
const task = yield fork(function* () {
while (true) {
const action = yield take(pattern)