title: Redux saga debounce and not just delay/cancel
body: <p>Is there a way to debounce in Redux-Saga where subsequent calls are queued up behind the same delay, which keeps getting bumped by each new task added to queue. Similar to lodash's debounce <a href="https://lodash.com/docs#debounce" rel="noreferrer">https://lodash.com/docs#debounce</a>.</p>
  
  <p>I currently have something similar to redux-saga's debounce but removed the cancel part as I still want to action each task, I just want to bundle up all events to fire in a single thread later.</p>
  
  <p>What I have currently:</p>
  
  <pre><code>const deferTime = 2000;
  const delay = (ms) =&gt; new Promise(resolve =&gt; setTimeout(resolve, ms));
  
  export function* sendClickEvent (event, debounce) {
    if (debounce) {
      yield call(delay, deferTime);
    }
    yield put(action(event));
  }
  
  export function* clickSaga () {
    while (true) {
      const action = yield take(WIDGET_CLICKED);
      const state = yield select();
      const debounce = action.meta &amp;&amp; action.meta.debounce;
      const payload = getWidgetClickPayload(state, action);
      const defaultData = getDefaultData(state);
      const event = {
        name: payload.name,
        data: Object.assign(defaultData, payload.data)
      };
      yield fork(sendClickEvent, event, debounce);
    }
  }
  </code></pre>
  
  <p>I tried assigning fork to variable and then checking if that was running (.isRunning()) but didn't know how I could postpone that fork by another delay.</p>