{"action":"created","issue":{"url":"https://api.github.com/repos/mysqljs/mysql/issues/1555","repository_url":"https://api.github.com/repos/mysqljs/mysql","labels_url":"https://api.github.com/repos/mysqljs/mysql/issues/1555/labels{/name}","comments_url":"https://api.github.com/repos/mysqljs/mysql/issues/1555/comments","events_url":"https://api.github.com/repos/mysqljs/mysql/issues/1555/events","html_url":"https://github.com/mysqljs/mysql/issues/1555","id":184877963,"number":1555,"title":"connection.query  incompatible with sleep function?","user":{"login":"JTorresConsulta","id":22349981,"avatar_url":"https://avatars.githubusercontent.com/u/22349981?v=3","gravatar_id":"","url":"https://api.github.com/users/JTorresConsulta","html_url":"https://github.com/JTorresConsulta","followers_url":"https://api.github.com/users/JTorresConsulta/followers","following_url":"https://api.github.com/users/JTorresConsulta/following{/other_user}","gists_url":"https://api.github.com/users/JTorresConsulta/gists{/gist_id}","starred_url":"https://api.github.com/users/JTorresConsulta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JTorresConsulta/subscriptions","organizations_url":"https://api.github.com/users/JTorresConsulta/orgs","repos_url":"https://api.github.com/users/JTorresConsulta/repos","events_url":"https://api.github.com/users/JTorresConsulta/events{/privacy}","received_events_url":"https://api.github.com/users/JTorresConsulta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-24T15:42:15Z","updated_at":"2016-10-25T10:24:12Z","closed_at":null,"body":" connection.query doesnt work when i set a sleep() function as it:\r\n\r\n```\r\nconnection.query('UPDATE......')\r\nsleepFor(2000);\r\n\r\nfunction sleepFor( sleepDuration ){\r\n    var now = new Date().getTime();\r\n    while(new Date().getTime() < now + sleepDuration){ /* do nothing */ } \r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/mysqljs/mysql/issues/comments/255997119","html_url":"https://github.com/mysqljs/mysql/issues/1555#issuecomment-255997119","issue_url":"https://api.github.com/repos/mysqljs/mysql/issues/1555","id":255997119,"user":{"login":"erikdubbelboer","id":522870,"avatar_url":"https://avatars.githubusercontent.com/u/522870?v=3","gravatar_id":"","url":"https://api.github.com/users/erikdubbelboer","html_url":"https://github.com/erikdubbelboer","followers_url":"https://api.github.com/users/erikdubbelboer/followers","following_url":"https://api.github.com/users/erikdubbelboer/following{/other_user}","gists_url":"https://api.github.com/users/erikdubbelboer/gists{/gist_id}","starred_url":"https://api.github.com/users/erikdubbelboer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikdubbelboer/subscriptions","organizations_url":"https://api.github.com/users/erikdubbelboer/orgs","repos_url":"https://api.github.com/users/erikdubbelboer/repos","events_url":"https://api.github.com/users/erikdubbelboer/events{/privacy}","received_events_url":"https://api.github.com/users/erikdubbelboer/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T10:24:12Z","updated_at":"2016-10-25T10:24:12Z","body":"That's because sleep is blocking the main thread preventing it from doing anything else, such as handling the query.\r\n\r\nI'm not sure what you are trying to accomplish. Maybe try something like:\r\n```js\r\nconnection.query('UPDATE......');\r\nsetTimeout(function() {\r\n  // Do what you wanted to do after the sleep.\r\n}, 2000);\r\n```"}}
{"actor":{"display_login":"erikdubbelboer"}}