mcollina / fastq

Fast, in memory work queue
ISC License
943 stars 47 forks source link

how to use with redux-saga? #56

Open jingyuLin1999 opened 3 years ago

jingyuLin1999 commented 3 years ago

could support function* worker

const mqQueue = require('fastq')({ select, fork }, worker, 1);
  eventbus.on(configs.topic_tools_status + configs.factoryCode + '_' + configs.shopCode.toLocaleUpperCase(), (msg) => {
      if (msg.Type_Data == 101 || msg.Type_Data == 106) mqQueue.push(msg) 
  })
  function* worker(arg, cb) {
      let bbb = this.select((state) => {
          return state.tools3Test
      });
      console.log(bbb)
      // yield put({ type: "consumerQueue", payload: { arg, cb } })
      cb(null, arg)
  }
mcollina commented 3 years ago

I'm a bit lost on who will receive the data that is going to be yielded.