{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5157","repository_url":"https://api.github.com/repos/pouchdb/pouchdb","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5157/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5157/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5157/events","html_url":"https://github.com/pouchdb/pouchdb/pull/5157","id":154466894,"number":5157,"title":"Regression in replicateTo method.","user":{"login":"man4j","id":490832,"avatar_url":"https://avatars.githubusercontent.com/u/490832?v=3","gravatar_id":"","url":"https://api.github.com/users/man4j","html_url":"https://github.com/man4j","followers_url":"https://api.github.com/users/man4j/followers","following_url":"https://api.github.com/users/man4j/following{/other_user}","gists_url":"https://api.github.com/users/man4j/gists{/gist_id}","starred_url":"https://api.github.com/users/man4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/man4j/subscriptions","organizations_url":"https://api.github.com/users/man4j/orgs","repos_url":"https://api.github.com/users/man4j/repos","events_url":"https://api.github.com/users/man4j/events{/privacy}","received_events_url":"https://api.github.com/users/man4j/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-05-12T12:10:11Z","updated_at":"2016-05-22T02:27:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pouchdb/pouchdb/pulls/5157","html_url":"https://github.com/pouchdb/pouchdb/pull/5157","diff_url":"https://github.com/pouchdb/pouchdb/pull/5157.diff","patch_url":"https://github.com/pouchdb/pouchdb/pull/5157.patch"},"body":"I have remote CouchDB with 30_000 docs. I replicateFrom all docs. But(!) replicateTo 'paused' events not trigger. And I see than pouchdb every seconds send _bulk_docs, _local and _revs_diff to CouchDB and I see in CouchDB \r\n\r\n```json\r\n{\r\n   \"_id\":\"_local/VfNqh5fhbhdOCfRFn8pEmA==\",\r\n   \"_rev\":\"0-675\",\r\n   \"session_id\":\"4241BF48-47C3-5446-B3FE-F329644B5F2E\",\r\n   \"history\":[\r\n      {\r\n         \"last_seq\":675,\r\n         \"session_id\":\"4241BF48-47C3-5446-B3FE-F329644B5F2E\"\r\n      }\r\n   ],\r\n   \"replicator\":\"pouchdb\",\r\n   \"version\":1,\r\n   \"last_seq\":675\r\n}\r\n```\r\n\r\nwhere last_seq increments by one. After last_seq = 30_000 'paused' events in replicateTo is triggered.  But when revert batches.length === 0 'paused' events trigger immediately as expected.\r\n\r\nBut, I have question number 2: why pouchdb send every second _bulk_docs, _local and _revs_diff to CouchDB?? And i See in CouchDB log: \r\n\r\n```json\r\n{\r\n   \"_id\":\"_local/VfNqh5fhbhdOCfRFn8pEmA==\",\r\n   \"_rev\":\"0-675\",\r\n   \"session_id\":\"4241BF48-47C3-5446-B3FE-F329644B5F2E\",\r\n   \"history\":[\r\n      {\r\n         \"last_seq\":675,\r\n         \"session_id\":\"4241BF48-47C3-5446-B3FE-F329644B5F2E\"\r\n      }\r\n   ],\r\n   \"replicator\":\"pouchdb\",\r\n   \"version\":1,\r\n   \"last_seq\":675\r\n}\r\n```\r\n\r\nwhere last_seq increments by one ??? I'm not create any docs locally in pouch. All docs was replicated from remote CouchDB. Oh... my head... Thanks!"},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/220810820","html_url":"https://github.com/pouchdb/pouchdb/pull/5157#issuecomment-220810820","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/5157","id":220810820,"user":{"login":"nolanlawson","id":283842,"avatar_url":"https://avatars.githubusercontent.com/u/283842?v=3","gravatar_id":"","url":"https://api.github.com/users/nolanlawson","html_url":"https://github.com/nolanlawson","followers_url":"https://api.github.com/users/nolanlawson/followers","following_url":"https://api.github.com/users/nolanlawson/following{/other_user}","gists_url":"https://api.github.com/users/nolanlawson/gists{/gist_id}","starred_url":"https://api.github.com/users/nolanlawson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nolanlawson/subscriptions","organizations_url":"https://api.github.com/users/nolanlawson/orgs","repos_url":"https://api.github.com/users/nolanlawson/repos","events_url":"https://api.github.com/users/nolanlawson/events{/privacy}","received_events_url":"https://api.github.com/users/nolanlawson/received_events","type":"User","site_admin":false},"created_at":"2016-05-22T02:27:48Z","updated_at":"2016-05-22T02:27:48Z","body":"Well, I tried to replicate this issue in a unit test, and I admit I'm unable to: f289d5035baceaf4dbab6206239d710faf71267d.\r\n\r\nHowever, I did try out @man4j 's test case, and I can agree that there are serious performance problems with replicating from the given CouchDB server, which I am unable to replicate locally because it probably involves failed requests across the network (and hence I cannot repro with localhost).\r\n\r\nWhat I'm seeing a lot of is this:\r\n\r\n![screenshot 2016-05-21 19 23 15](https://cloud.githubusercontent.com/assets/283842/15451774/e1894ec4-1f89-11e6-85e1-62395840d794.png)\r\n\r\nI.e. the browser is being starved because we're making many many simultaneous GET requests, of which the majority are canceled. Then it tries again. All the while, the UI is running very slowly because the concurrent Ajax requests are starving the UI thread.\r\n\r\nI think this is another issue that requires its own fix (throttle network requests in the `bulkGetShim()`, although it doesn't address the issue raised in this PR. I'm still unable to find a test that 1) fails in master, but 2) succeeds with the proposed fix (i.e. https://github.com/pouchdb/pouchdb/pull/5180)."}}
{"actor":{"display_login":"nolanlawson"}}