{"action":"opened","issue":{"url":"https://api.github.com/repos/tobilg/buffered-queue/issues/1","labels_url":"https://api.github.com/repos/tobilg/buffered-queue/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/tobilg/buffered-queue/issues/1/comments","events_url":"https://api.github.com/repos/tobilg/buffered-queue/issues/1/events","html_url":"https://github.com/tobilg/buffered-queue/issues/1","id":121514704,"number":1,"title":"Data is lost after flush event is emitted","user":{"login":"kakashif","id":1165877,"avatar_url":"https://avatars.githubusercontent.com/u/1165877?v=3","gravatar_id":"","url":"https://api.github.com/users/kakashif","html_url":"https://github.com/kakashif","followers_url":"https://api.github.com/users/kakashif/followers","following_url":"https://api.github.com/users/kakashif/following{/other_user}","gists_url":"https://api.github.com/users/kakashif/gists{/gist_id}","starred_url":"https://api.github.com/users/kakashif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kakashif/subscriptions","organizations_url":"https://api.github.com/users/kakashif/orgs","repos_url":"https://api.github.com/users/kakashif/repos","events_url":"https://api.github.com/users/kakashif/events{/privacy}","received_events_url":"https://api.github.com/users/kakashif/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-10T15:44:02Z","updated_at":"2015-12-10T15:44:02Z","closed_at":null,"body":"I think the buffered queue should create a shallow copy of the items before calling on flush.  Here is my issue.  I am creating the buffered queue with the following configurations for testing without the customResultFunction function:\r\n```\r\n{\r\n    size: 1,\r\n    flushTimeout: 5000,\r\n    verbose: false\r\n}\r\n```\r\nAnd then on flush, I have:\r\n```\r\nq.on('flush', function(data) {\r\n    // where data[i] => {payload:{}, message: {}};\r\n    myHandler.emit('queue-batch-ready', data);\r\n});\r\n```\r\nI handle the payload part of the array on queue-batch-ready event and then emit another event to handle the message part of the array.  However, by the time I get to processing messages, the data array is empty.  "}}