{"action":"created","comment":{"url":"https://api.github.com/repos/GolosChain/tolstoy/pulls/comments/243191557","pull_request_review_id":186893523,"id":243191557,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MzE5MTU1Nw==","diff_hunk":"@@ -0,0 +1,64 @@\n+import { takeEvery } from 'redux-saga/effects';\n+import throttle from 'lodash/throttle';\n+import { dispatch } from 'app/clientRender';\n+\n+import { GATE_SEND_MESSAGE } from '../constants/gate';\n+import { POST_NEED_VIEW_COUNT, POST_FETCH_VIEW_COUNT_SUCCESS } from '../constants/post';\n+\n+const queue = new Set();\n+const loading = new Set();\n+\n+export default function* watch() {\n+    yield takeEvery(POST_NEED_VIEW_COUNT, loadHistorical);\n+}\n+\n+function* loadHistorical({ payload }) {\n+    if (!process.env.BROWSER) {\n+        return;\n+    }\n+\n+    const { postLink } = payload;\n+\n+    if (!queue.has(postLink) && !loading.has(postLink)) {\n+        queue.add(postLink);\n+\n+        startLoadingLazy();\n+    }\n+}\n+\n+let reloadTimeout = null;\n+\n+async function startLoading() {\n+    clearTimeout(reloadTimeout);\n+\n+    if (!queue.size) {\n+        return;\n+    }\n+\n+    const load = Array.from(queue);\n+\n+    for (const date of queue) {\n+        loading.add(date);\n+    }\n+\n+    queue.clear();\n+\n+    dispatch({\n+        type: GATE_SEND_MESSAGE,\n+        payload: {\n+            method: 'meta.getPostsViewCount',\n+            types: [null, POST_FETCH_VIEW_COUNT_SUCCESS],\n+            data: { postLinks: load },\n+            successCallback: onDone,\n+            errorCallback: onDone,\n+        },\n+    });\n+\n+    function onDone() {\n+        for (const link of load) {\n+            loading.delete(link);\n+        }\n+    }\n+}\n+\n+const startLoadingLazy = throttle(startLoading, 150, { leading: false });","path":"src/app/redux/sagas/viewCount.js","position":64,"original_position":64,"commit_id":"dcf41623c7ab084d71932fc4101cb732cde9c87f","original_commit_id":"dcf41623c7ab084d71932fc4101cb732cde9c87f","user":{"login":"beautyfree","id":656531,"node_id":"MDQ6VXNlcjY1NjUzMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/656531?v=4","gravatar_id":"","url":"https://api.github.com/users/beautyfree","html_url":"https://github.com/beautyfree","followers_url":"https://api.github.com/users/beautyfree/followers","following_url":"https://api.github.com/users/beautyfree/following{/other_user}","gists_url":"https://api.github.com/users/beautyfree/gists{/gist_id}","starred_url":"https://api.github.com/users/beautyfree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beautyfree/subscriptions","organizations_url":"https://api.github.com/users/beautyfree/orgs","repos_url":"https://api.github.com/users/beautyfree/repos","events_url":"https://api.github.com/users/beautyfree/events{/privacy}","received_events_url":"https://api.github.com/users/beautyfree/received_events","type":"User","site_admin":false},"body":"https://redux-saga.js.org/docs/api/#throttlems-pattern-saga-args","created_at":"2018-12-20T08:46:04Z","updated_at":"2018-12-20T08:46:27Z","html_url":"https://github.com/GolosChain/tolstoy/pull/1834#discussion_r243191557","pull_request_url":"https://api.github.com/repos/GolosChain/tolstoy/pulls/1834","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/GolosChain/tolstoy/pulls/comments/243191557"},"html":{"href":"https://github.com/GolosChain/tolstoy/pull/1834#discussion_r243191557"},"pull_request":{"href":"https://api.github.com/repos/GolosChain/tolstoy/pulls/1834"}}},"pull_request":{"url":"https://api.github.com/repos/GolosChain/tolstoy/pulls/1834","id":239864367,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5ODY0MzY3","html_url":"https://github.com/GolosChain/tolstoy/pull/1834","diff_url":"https://github.com/GolosChain/tolstoy/pull/1834.diff","patch_url":"https://github.com/GolosChain/tolstoy/pull/1834.patch","issue_url":"https://api.github.com/repos/GolosChain/tolstoy/issues/1834","number":1834,"state":"open","locked":false,"title":"1769 add view counter","user":{"login":"Bacher","id":2598671,"node_id":"MDQ6VXNlcjI1OTg2NzE=","avatar_url":"https://avatars2.githubusercontent.com/u/2598671?v=4","gravatar_id":"","url":"https://api.github.com/users/Bacher","html_url":"https://github.com/Bacher","followers_url":"https://api.github.com/users/Bacher/followers","following_url":"https://api.github.com/users/Bacher/following{/other_user}","gists_url":"https://api.github.com/users/Bacher/gists{/gist_id}","starred_url":"https://api.github.com/users/Bacher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bacher/subscriptions","organizations_url":"https://api.github.com/users/Bacher/orgs","repos_url":"https://api.github.com/users/Bacher/repos","events_url":"https://api.github.com/users/Bacher/events{/privacy}","received_events_url":"https://api.github.com/users/Bacher/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-19T14:55:28Z","updated_at":"2018-12-20T08:46:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5e9de9270ed0726746472fb549fbc01b177d47d","assignee":null,"assignees":[],"requested_reviewers":[{"login":"b1acksun","id":3322340,"node_id":"MDQ6VXNlcjMzMjIzNDA=","avatar_url":"https://avatars1.githubusercontent.com/u/3322340?v=4","gravatar_id":"","url":"https://api.github.com/users/b1acksun","html_url":"https://github.com/b1acksun","followers_url":"https://api.github.com/users/b1acksun/followers","following_url":"https://api.github.com/users/b1acksun/following{/other_user}","gists_url":"https://api.github.com/users/b1acksun/gists{/gist_id}","starred_url":"https://api.github.com/users/b1acksun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b1acksun/subscriptions","organizations_url":"https://api.github.com/users/b1acksun/orgs","repos_url":"https://api.github.com/users/b1acksun/repos","events_url":"https://api.github.com/users/b1acksun/events{/privacy}","received_events_url":"https://api.github.com/users/b1acksun/received_events","type":"User","site_admin":false},{"login":"Nikita-Pobazhak","id":32985694,"node_id":"MDQ6VXNlcjMyOTg1Njk0","avatar_url":"https://avatars1.githubusercontent.com/u/32985694?v=4","gravatar_id":"","url":"https://api.github.com/users/Nikita-Pobazhak","html_url":"https://github.com/Nikita-Pobazhak","followers_url":"https://api.github.com/users/Nikita-Pobazhak/followers","following_url":"https://api.github.com/users/Nikita-Pobazhak/following{/other_user}","gists_url":"https://api.github.com/users/Nikita-Pobazhak/gists{/gist_id}","starred_url":"https://api.github.com/users/Nikita-Pobazhak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nikita-Pobazhak/subscriptions","organizations_url":"https://api.github.com/users/Nikita-Pobazhak/orgs","repos_url":"https://api.github.com/users/Nikita-Pobazhak/repos","events_url":"https://api.github.com/users/Nikita-Pobazhak/events{/privacy}","received_events_url":"https://api.github.com/users/Nikita-Pobazhak/received_events","type":"User","site_admin":false},{"login":"AlexRekish","id":37471019,"node_id":"MDQ6VXNlcjM3NDcxMDE5","avatar_url":"https://avatars2.githubusercontent.com/u/37471019?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexRekish","html_url":"https://github.com/AlexRekish","followers_url":"https://api.github.com/users/AlexRekish/followers","following_url":"https://api.github.com/users/AlexRekish/following{/other_user}","gists_url":"https://api.github.com/users/AlexRekish/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexRekish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexRekish/subscriptions","organizations_url":"https://api.github.com/users/AlexRekish/orgs","repos_url":"https://api.github.com/users/AlexRekish/repos","events_url":"https://api.github.com/users/AlexRekish/events{/privacy}","received_events_url":"https://api.github.com/users/AlexRekish/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/GolosChain/tolstoy/pulls/1834/commits","review_comments_url":"https://api.github.com/repos/GolosChain/tolstoy/pulls/1834/comments","review_comment_url":"https://api.github.com/repos/GolosChain/tolstoy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GolosChain/tolstoy/issues/1834/comments","statuses_url":"https://api.github.com/repos/GolosChain/tolstoy/statuses/dcf41623c7ab084d71932fc4101cb732cde9c87f","head":{"label":"GolosChain:1769_add-view-counter","ref":"1769_add-view-counter","sha":"dcf41623c7ab084d71932fc4101cb732cde9c87f","user":{"login":"GolosChain","id":20841297,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODQxMjk3","avatar_url":"https://avatars0.githubusercontent.com/u/20841297?v=4","gravatar_id":"","url":"https://api.github.com/users/GolosChain","html_url":"https://github.com/GolosChain","followers_url":"https://api.github.com/users/GolosChain/followers","following_url":"https://api.github.com/users/GolosChain/following{/other_user}","gists_url":"https://api.github.com/users/GolosChain/gists{/gist_id}","starred_url":"https://api.github.com/users/GolosChain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GolosChain/subscriptions","organizations_url":"https://api.github.com/users/GolosChain/orgs","repos_url":"https://api.github.com/users/GolosChain/repos","events_url":"https://api.github.com/users/GolosChain/events{/privacy}","received_events_url":"https://api.github.com/users/GolosChain/received_events","type":"Organization","site_admin":false},"repo":{"id":64941562,"node_id":"MDEwOlJlcG9zaXRvcnk2NDk0MTU2Mg==","name":"tolstoy","full_name":"GolosChain/tolstoy","private":false,"owner":{"login":"GolosChain","id":20841297,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODQxMjk3","avatar_url":"https://avatars0.githubusercontent.com/u/20841297?v=4","gravatar_id":"","url":"https://api.github.com/users/GolosChain","html_url":"https://github.com/GolosChain","followers_url":"https://api.github.com/users/GolosChain/followers","following_url":"https://api.github.com/users/GolosChain/following{/other_user}","gists_url":"https://api.github.com/users/GolosChain/gists{/gist_id}","starred_url":"https://api.github.com/users/GolosChain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GolosChain/subscriptions","organizations_url":"https://api.github.com/users/GolosChain/orgs","repos_url":"https://api.github.com/users/GolosChain/repos","events_url":"https://api.github.com/users/GolosChain/events{/privacy}","received_events_url":"https://api.github.com/users/GolosChain/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/GolosChain/tolstoy","description":"Golos Blockchain Social Web Application","fork":true,"url":"https://api.github.com/repos/GolosChain/tolstoy","forks_url":"https://api.github.com/repos/GolosChain/tolstoy/forks","keys_url":"https://api.github.com/repos/GolosChain/tolstoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GolosChain/tolstoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GolosChain/tolstoy/teams","hooks_url":"https://api.github.com/repos/GolosChain/tolstoy/hooks","issue_events_url":"https://api.github.com/repos/GolosChain/tolstoy/issues/events{/number}","events_url":"https://api.github.com/repos/GolosChain/tolstoy/events","assignees_url":"https://api.github.com/repos/GolosChain/tolstoy/assignees{/user}","branches_url":"https://api.github.com/repos/GolosChain/tolstoy/branches{/branch}","tags_url":"https://api.github.com/repos/GolosChain/tolstoy/tags","blobs_url":"https://api.github.com/repos/GolosChain/tolstoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GolosChain/tolstoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GolosChain/tolstoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/GolosChain/tolstoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GolosChain/tolstoy/statuses/{sha}","languages_url":"https://api.github.com/repos/GolosChain/tolstoy/languages","stargazers_url":"https://api.github.com/repos/GolosChain/tolstoy/stargazers","contributors_url":"https://api.github.com/repos/GolosChain/tolstoy/contributors","subscribers_url":"https://api.github.com/repos/GolosChain/tolstoy/subscribers","subscription_url":"https://api.github.com/repos/GolosChain/tolstoy/subscription","commits_url":"https://api.github.com/repos/GolosChain/tolstoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/GolosChain/tolstoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/GolosChain/tolstoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/GolosChain/tolstoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/GolosChain/tolstoy/contents/{+path}","compare_url":"https://api.github.com/repos/GolosChain/tolstoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GolosChain/tolstoy/merges","archive_url":"https://api.github.com/repos/GolosChain/tolstoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GolosChain/tolstoy/downloads","issues_url":"https://api.github.com/repos/GolosChain/tolstoy/issues{/number}","pulls_url":"https://api.github.com/repos/GolosChain/tolstoy/pulls{/number}","milestones_url":"https://api.github.com/repos/GolosChain/tolstoy/milestones{/number}","notifications_url":"https://api.github.com/repos/GolosChain/tolstoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GolosChain/tolstoy/labels{/name}","releases_url":"https://api.github.com/repos/GolosChain/tolstoy/releases{/id}","deployments_url":"https://api.github.com/repos/GolosChain/tolstoy/deployments","created_at":"2016-08-04T14:30:43Z","updated_at":"2018-12-19T11:15:34Z","pushed_at":"2018-12-20T08:43:11Z","git_url":"git://github.com/GolosChain/tolstoy.git","ssh_url":"git@github.com:GolosChain/tolstoy.git","clone_url":"https://github.com/GolosChain/tolstoy.git","svn_url":"https://github.com/GolosChain/tolstoy","homepage":"https://golos.io","size":40251,"stargazers_count":42,"watchers_count":42,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":35,"mirror_url":null,"archived":false,"open_issues_count":244,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":35,"open_issues":244,"watchers":42,"default_branch":"master"}},"base":{"label":"GolosChain:redesign-refactoring","ref":"redesign-refactoring","sha":"f42261033a2fecb9100c393e47f4d7e8f4b45e22","user":{"login":"GolosChain","id":20841297,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODQxMjk3","avatar_url":"https://avatars0.githubusercontent.com/u/20841297?v=4","gravatar_id":"","url":"https://api.github.com/users/GolosChain","html_url":"https://github.com/GolosChain","followers_url":"https://api.github.com/users/GolosChain/followers","following_url":"https://api.github.com/users/GolosChain/following{/other_user}","gists_url":"https://api.github.com/users/GolosChain/gists{/gist_id}","starred_url":"https://api.github.com/users/GolosChain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GolosChain/subscriptions","organizations_url":"https://api.github.com/users/GolosChain/orgs","repos_url":"https://api.github.com/users/GolosChain/repos","events_url":"https://api.github.com/users/GolosChain/events{/privacy}","received_events_url":"https://api.github.com/users/GolosChain/received_events","type":"Organization","site_admin":false},"repo":{"id":64941562,"node_id":"MDEwOlJlcG9zaXRvcnk2NDk0MTU2Mg==","name":"tolstoy","full_name":"GolosChain/tolstoy","private":false,"owner":{"login":"GolosChain","id":20841297,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwODQxMjk3","avatar_url":"https://avatars0.githubusercontent.com/u/20841297?v=4","gravatar_id":"","url":"https://api.github.com/users/GolosChain","html_url":"https://github.com/GolosChain","followers_url":"https://api.github.com/users/GolosChain/followers","following_url":"https://api.github.com/users/GolosChain/following{/other_user}","gists_url":"https://api.github.com/users/GolosChain/gists{/gist_id}","starred_url":"https://api.github.com/users/GolosChain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GolosChain/subscriptions","organizations_url":"https://api.github.com/users/GolosChain/orgs","repos_url":"https://api.github.com/users/GolosChain/repos","events_url":"https://api.github.com/users/GolosChain/events{/privacy}","received_events_url":"https://api.github.com/users/GolosChain/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/GolosChain/tolstoy","description":"Golos Blockchain Social Web Application","fork":true,"url":"https://api.github.com/repos/GolosChain/tolstoy","forks_url":"https://api.github.com/repos/GolosChain/tolstoy/forks","keys_url":"https://api.github.com/repos/GolosChain/tolstoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GolosChain/tolstoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GolosChain/tolstoy/teams","hooks_url":"https://api.github.com/repos/GolosChain/tolstoy/hooks","issue_events_url":"https://api.github.com/repos/GolosChain/tolstoy/issues/events{/number}","events_url":"https://api.github.com/repos/GolosChain/tolstoy/events","assignees_url":"https://api.github.com/repos/GolosChain/tolstoy/assignees{/user}","branches_url":"https://api.github.com/repos/GolosChain/tolstoy/branches{/branch}","tags_url":"https://api.github.com/repos/GolosChain/tolstoy/tags","blobs_url":"https://api.github.com/repos/GolosChain/tolstoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GolosChain/tolstoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GolosChain/tolstoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/GolosChain/tolstoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GolosChain/tolstoy/statuses/{sha}","languages_url":"https://api.github.com/repos/GolosChain/tolstoy/languages","stargazers_url":"https://api.github.com/repos/GolosChain/tolstoy/stargazers","contributors_url":"https://api.github.com/repos/GolosChain/tolstoy/contributors","subscribers_url":"https://api.github.com/repos/GolosChain/tolstoy/subscribers","subscription_url":"https://api.github.com/repos/GolosChain/tolstoy/subscription","commits_url":"https://api.github.com/repos/GolosChain/tolstoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/GolosChain/tolstoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/GolosChain/tolstoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/GolosChain/tolstoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/GolosChain/tolstoy/contents/{+path}","compare_url":"https://api.github.com/repos/GolosChain/tolstoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GolosChain/tolstoy/merges","archive_url":"https://api.github.com/repos/GolosChain/tolstoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GolosChain/tolstoy/downloads","issues_url":"https://api.github.com/repos/GolosChain/tolstoy/issues{/number}","pulls_url":"https://api.github.com/repos/GolosChain/tolstoy/pulls{/number}","milestones_url":"https://api.github.com/repos/GolosChain/tolstoy/milestones{/number}","notifications_url":"https://api.github.com/repos/GolosChain/tolstoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GolosChain/tolstoy/labels{/name}","releases_url":"https://api.github.com/repos/GolosChain/tolstoy/releases{/id}","deployments_url":"https://api.github.com/repos/GolosChain/tolstoy/deployments","created_at":"2016-08-04T14:30:43Z","updated_at":"2018-12-19T11:15:34Z","pushed_at":"2018-12-20T08:43:11Z","git_url":"git://github.com/GolosChain/tolstoy.git","ssh_url":"git@github.com:GolosChain/tolstoy.git","clone_url":"https://github.com/GolosChain/tolstoy.git","svn_url":"https://github.com/GolosChain/tolstoy","homepage":"https://golos.io","size":40251,"stargazers_count":42,"watchers_count":42,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":35,"mirror_url":null,"archived":false,"open_issues_count":244,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":35,"open_issues":244,"watchers":42,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GolosChain/tolstoy/pulls/1834"},"html":{"href":"https://github.com/GolosChain/tolstoy/pull/1834"},"issue":{"href":"https://api.github.com/repos/GolosChain/tolstoy/issues/1834"},"comments":{"href":"https://api.github.com/repos/GolosChain/tolstoy/issues/1834/comments"},"review_comments":{"href":"https://api.github.com/repos/GolosChain/tolstoy/pulls/1834/comments"},"review_comment":{"href":"https://api.github.com/repos/GolosChain/tolstoy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GolosChain/tolstoy/pulls/1834/commits"},"statuses":{"href":"https://api.github.com/repos/GolosChain/tolstoy/statuses/dcf41623c7ab084d71932fc4101cb732cde9c87f"}},"author_association":"NONE"}}
{"actor":{"display_login":"beautyfree"}}