{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4028","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4028/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4028/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4028/events","html_url":"https://github.com/pouchdb/pouchdb/pull/4028","id":93215010,"number":4028,"title":"fix for high CPU utilization","user":{"login":"michalchochol","id":12829373,"avatar_url":"https://avatars.githubusercontent.com/u/12829373?v=3","gravatar_id":"","url":"https://api.github.com/users/michalchochol","html_url":"https://github.com/michalchochol","followers_url":"https://api.github.com/users/michalchochol/followers","following_url":"https://api.github.com/users/michalchochol/following{/other_user}","gists_url":"https://api.github.com/users/michalchochol/gists{/gist_id}","starred_url":"https://api.github.com/users/michalchochol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michalchochol/subscriptions","organizations_url":"https://api.github.com/users/michalchochol/orgs","repos_url":"https://api.github.com/users/michalchochol/repos","events_url":"https://api.github.com/users/michalchochol/events{/privacy}","received_events_url":"https://api.github.com/users/michalchochol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-06T07:48:29Z","updated_at":"2015-07-06T16:50:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pouchdb/pouchdb/pulls/4028","html_url":"https://github.com/pouchdb/pouchdb/pull/4028","diff_url":"https://github.com/pouchdb/pouchdb/pull/4028.diff","patch_url":"https://github.com/pouchdb/pouchdb/pull/4028.patch"},"body":"Fix resolves the problem of high CPU utilization, caused by by infinite loop of change listeners. \r\n\r\nHere is the code to reproduce problem:\r\n\r\n<!doctype html>\r\n<title>PouchDB issue #3632</title>\r\n<script type=\"text/javascript\" src=\"https://github.com/pouchdb/pouchdb/releases/download/3.6.0/pouchdb-3.6.0.min.js\"></script>\r\n<script type=\"text/javascript\">                                                                                                                 \r\nvar testDb = new PouchDB(\"bug3632\");                                                                                                      \r\n\r\nfor(var i=1; i<10; ++i) {\r\n  (function(i) {                                                                                                                       \r\n    testDb.changes({live:true}).on(\"change\", function(change) {                                                                                   \r\n      console.log('listener' + i + ' got a change event');                                                                                        \r\n    });\r\n  })(i);\r\n}\r\n\r\nsetTimeout(function() {                                                                                                                         \r\n  testDb.put({'_id': ''+new Date().getTime(), 'msg': 'Hello PouchDB'});                                                                         \r\n}, 200);                                                                                                                                        \r\n</script>"},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/118922853","html_url":"https://github.com/pouchdb/pouchdb/pull/4028#issuecomment-118922853","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4028","id":118922853,"user":{"login":"daleharvey","id":37787,"avatar_url":"https://avatars.githubusercontent.com/u/37787?v=3","gravatar_id":"","url":"https://api.github.com/users/daleharvey","html_url":"https://github.com/daleharvey","followers_url":"https://api.github.com/users/daleharvey/followers","following_url":"https://api.github.com/users/daleharvey/following{/other_user}","gists_url":"https://api.github.com/users/daleharvey/gists{/gist_id}","starred_url":"https://api.github.com/users/daleharvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daleharvey/subscriptions","organizations_url":"https://api.github.com/users/daleharvey/orgs","repos_url":"https://api.github.com/users/daleharvey/repos","events_url":"https://api.github.com/users/daleharvey/events{/privacy}","received_events_url":"https://api.github.com/users/daleharvey/received_events","type":"User","site_admin":false},"created_at":"2015-07-06T16:50:12Z","updated_at":"2015-07-06T16:50:12Z","body":"hrm @calvinmetcalf any opinions on this? Happy to merge as a workaround but I would really like to understand whats causing this in the first place and see if we can figure out a test to ensure it doesnt happen again\r\n\r\n"}}