{"action":"created","issue":{"url":"https://api.github.com/repos/diamondio/better-queue/issues/36","repository_url":"https://api.github.com/repos/diamondio/better-queue","labels_url":"https://api.github.com/repos/diamondio/better-queue/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/diamondio/better-queue/issues/36/comments","events_url":"https://api.github.com/repos/diamondio/better-queue/issues/36/events","html_url":"https://github.com/diamondio/better-queue/issues/36","id":344500473,"node_id":"MDU6SXNzdWUzNDQ1MDA0NzM=","number":36,"title":"concurrent problem, wrong order ","user":{"login":"GonzoBe","id":25350906,"node_id":"MDQ6VXNlcjI1MzUwOTA2","avatar_url":"https://avatars2.githubusercontent.com/u/25350906?v=4","gravatar_id":"","url":"https://api.github.com/users/GonzoBe","html_url":"https://github.com/GonzoBe","followers_url":"https://api.github.com/users/GonzoBe/followers","following_url":"https://api.github.com/users/GonzoBe/following{/other_user}","gists_url":"https://api.github.com/users/GonzoBe/gists{/gist_id}","starred_url":"https://api.github.com/users/GonzoBe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GonzoBe/subscriptions","organizations_url":"https://api.github.com/users/GonzoBe/orgs","repos_url":"https://api.github.com/users/GonzoBe/repos","events_url":"https://api.github.com/users/GonzoBe/events{/privacy}","received_events_url":"https://api.github.com/users/GonzoBe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-25T15:44:11Z","updated_at":"2018-07-26T07:33:21Z","closed_at":null,"author_association":"NONE","body":"Hi, I have problem with concurrent, if I have concurrent set on 8 (for example) and add many tasks the task are do in wrong order. the first 7 is do invert the rest is done normally. There is no easy explanation how it will behave when I push 100 task for example. Sometimes is just first 8 in wrong order sometimes is first 16 but than I got something like this 7 6 5 4 3 2 1 11 10 8 9 12 13 14 15 16.  The filo option is set on false so first in first out."},"comment":{"url":"https://api.github.com/repos/diamondio/better-queue/issues/comments/408004922","html_url":"https://github.com/diamondio/better-queue/issues/36#issuecomment-408004922","issue_url":"https://api.github.com/repos/diamondio/better-queue/issues/36","id":408004922,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODAwNDkyMg==","user":{"login":"GonzoBe","id":25350906,"node_id":"MDQ6VXNlcjI1MzUwOTA2","avatar_url":"https://avatars2.githubusercontent.com/u/25350906?v=4","gravatar_id":"","url":"https://api.github.com/users/GonzoBe","html_url":"https://github.com/GonzoBe","followers_url":"https://api.github.com/users/GonzoBe/followers","following_url":"https://api.github.com/users/GonzoBe/following{/other_user}","gists_url":"https://api.github.com/users/GonzoBe/gists{/gist_id}","starred_url":"https://api.github.com/users/GonzoBe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GonzoBe/subscriptions","organizations_url":"https://api.github.com/users/GonzoBe/orgs","repos_url":"https://api.github.com/users/GonzoBe/repos","events_url":"https://api.github.com/users/GonzoBe/events{/privacy}","received_events_url":"https://api.github.com/users/GonzoBe/received_events","type":"User","site_admin":false},"created_at":"2018-07-26T07:33:21Z","updated_at":"2018-07-26T07:33:21Z","author_association":"NONE","body":"```javascript\r\nvar Queue = require('better-queue');\r\nvar cc = new Queue(mainTaskQueue, {\r\n    concurrent: 8,\r\n    filo: false, \r\n    maxTimeout: 1000,\r\n    retryDelay: 100,\r\n    maxRetries: 3,\r\n    afterProcessDelay: 1,\r\n});\r\nfor(let i=0; i<10;  i++) {\r\n    let task = {nr:i};\r\n    cc.push(task);\r\n}\r\n```\r\n```\r\n[Output]:\r\nNr:  6\r\nNr:  5\r\nNr:  4\r\nNr:  3\r\nNr:  2\r\nNr:  1\r\nNr:  0\r\nNr:  7\r\nNr:  9\r\nNr:  8\r\n```\r\nWhat I would like to achive and I did by changing line order in your code like i wrote before.\r\nYour recursive program starts task after checking that another can be started. I think you should start and than check that you can start another one. Also you should think about filo parameter here. \r\n```\r\n[Output]:\r\nNr:  0\r\nNr:  1\r\nNr:  2\r\nNr:  3\r\nNr:  4\r\nNr:  5\r\nNr:  6\r\nNr:  7\r\nNr:  8\r\nNr:  9\r\n```\r\n"}}
{"actor":{"display_login":"GonzoBe"}}