You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I've been trying to use this library and am having a bit a weird time with it. I've written a simple class and a test to show what I'm seeing. The long and short of it is that how I'm setting it up seems to make only every other message on the queue get polled. I'm assuming I've done something wrong and somebody amazing might be able to point it out 🙏
import{BrokenQueue}from'./broken-queue'jest.setTimeout(30000)exportasyncfunctionsleep(timeoutMs: number): Promise<void>{returnnewPromise(resolve=>setTimeout(resolve,timeoutMs))}// Just a simple function I can spy onconstmessagesReceived={check: (message: string)=>{}}constspy=jest.spyOn(messagesReceived,'check')describe('broken queue integration',()=>{letsut: BrokenQueueasyncfunctionpurgeQueue(){// Is there a better way to purge the various `sub queues` apart from obliterate?returnPromise.all(['completed','wait','active','paused','delayed','failed'].map(jobState=>sut['queue'].clean(5000,100,jobStateasany)))}describe('when sending multiple messages',()=>{beforeAll(async()=>{sut=newBrokenQueue(messagesReceived)awaitsut.initialise()})afterAll(async()=>{awaitsut.dispose()awaitpurgeQueue()spy.mockReset()})it('it should receive all four messages in the correct order',async()=>{constfourMessages=['one','two','three','four']// send all four messages - one after another to try to ensure predictable orderfor(constmessageoffourMessages){awaitsut.send('test',message)}// start polling for messagessut.pollForMessages()// wait generouslyawaitsleep(6000)expect(spy).toHaveBeenCalledTimes(4)expect(spy).toHaveBeenNthCalledWith(1,'one')expect(spy).toHaveBeenNthCalledWith(2,'two')expect(spy).toHaveBeenNthCalledWith(3,'three')expect(spy).toHaveBeenNthCalledWith(4,'four')})})})
The strange every other message output.
Thanks for your time - also if you notice anything basically wrong with this implementation, how its being created and torn down I'd be keen to know also. Thanks again.
The text was updated successfully, but these errors were encountered:
mod35
changed the title
Only ever other message is pulled from the queue
Only every other message is pulled from the queue
Aug 14, 2021
Hello,
I've been trying to use this library and am having a bit a weird time with it. I've written a simple class and a test to show what I'm seeing. The long and short of it is that how I'm setting it up seems to make only every other message on the queue get polled. I'm assuming I've done something wrong and somebody amazing might be able to point it out 🙏
node version: v12.14.1
bullmq version: 1.40.4
The setup docker-compose.yml
The simple implementation
Test file
The strange every other message output.
Thanks for your time - also if you notice anything basically wrong with this implementation, how its being created and torn down I'd be keen to know also. Thanks again.
The text was updated successfully, but these errors were encountered: