{"action":"created","comment":{"url":"https://api.github.com/repos/decred/dcrdata/pulls/comments/233526989","pull_request_review_id":174962010,"id":233526989,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzUyNjk4OQ==","diff_hunk":"@@ -513,6 +534,16 @@ func (exp *explorerUI) Store(blockData *blockdata.BlockData, msgBlock *wire.MsgB\n \t\tgo exp.updateDevFundBalance()\n \t}\n \n+\t// Update the charts data after every five blocks or if no charts data\n+\t// exists yet. Do not update the charts data if blockchain sync is running.","path":"explorer/explorer.go","position":157,"original_position":157,"commit_id":"37aacd515038814cbd0e5cf2f58009640beffb14","original_commit_id":"37aacd515038814cbd0e5cf2f58009640beffb14","user":{"login":"dmigwi","id":22055953,"node_id":"MDQ6VXNlcjIyMDU1OTUz","avatar_url":"https://avatars1.githubusercontent.com/u/22055953?v=4","gravatar_id":"","url":"https://api.github.com/users/dmigwi","html_url":"https://github.com/dmigwi","followers_url":"https://api.github.com/users/dmigwi/followers","following_url":"https://api.github.com/users/dmigwi/following{/other_user}","gists_url":"https://api.github.com/users/dmigwi/gists{/gist_id}","starred_url":"https://api.github.com/users/dmigwi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmigwi/subscriptions","organizations_url":"https://api.github.com/users/dmigwi/orgs","repos_url":"https://api.github.com/users/dmigwi/repos","events_url":"https://api.github.com/users/dmigwi/events{/privacy}","received_events_url":"https://api.github.com/users/dmigwi/received_events","type":"User","site_admin":false},"body":"It actually doesn't run after my test. Let me look at the code again to see what I missed.","created_at":"2018-11-14T16:43:05Z","updated_at":"2018-11-14T16:43:05Z","html_url":"https://github.com/decred/dcrdata/pull/816#discussion_r233526989","pull_request_url":"https://api.github.com/repos/decred/dcrdata/pulls/816","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/comments/233526989"},"html":{"href":"https://github.com/decred/dcrdata/pull/816#discussion_r233526989"},"pull_request":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/816"}},"in_reply_to_id":233521763},"pull_request":{"url":"https://api.github.com/repos/decred/dcrdata/pulls/816","id":230652877,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNjUyODc3","html_url":"https://github.com/decred/dcrdata/pull/816","diff_url":"https://github.com/decred/dcrdata/pull/816.diff","patch_url":"https://github.com/decred/dcrdata/pull/816.patch","issue_url":"https://api.github.com/repos/decred/dcrdata/issues/816","number":816,"state":"open","locked":false,"title":"pre-populate charts data tweaks","user":{"login":"chappjc","id":9373513,"node_id":"MDQ6VXNlcjkzNzM1MTM=","avatar_url":"https://avatars1.githubusercontent.com/u/9373513?v=4","gravatar_id":"","url":"https://api.github.com/users/chappjc","html_url":"https://github.com/chappjc","followers_url":"https://api.github.com/users/chappjc/followers","following_url":"https://api.github.com/users/chappjc/following{/other_user}","gists_url":"https://api.github.com/users/chappjc/gists{/gist_id}","starred_url":"https://api.github.com/users/chappjc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chappjc/subscriptions","organizations_url":"https://api.github.com/users/chappjc/orgs","repos_url":"https://api.github.com/users/chappjc/repos","events_url":"https://api.github.com/users/chappjc/events{/privacy}","received_events_url":"https://api.github.com/users/chappjc/received_events","type":"User","site_admin":false},"body":"Do not pre-populate charts data in `explorer.New`. Wait for initial `Store`.\r\n\r\nGive `explorer.chartDataCounter` a `Height` and `Update` function. `Height` returns -1 when data has never been assigned.\r\nIn `prePopulateChartsData`, return without update if cache is at same height as the `explorerUI` (as determined by `.pageData.BlockInfo.Height` via `(*explorerUI).Height`).\r\nIn `(*explorerUI).Store`, only run `prePopulateChartsData` AFTER storing the new `BlockInfo` in `pageData`.\r\n\r\nAvoid launching two identical queries by holding the `chartDataCounter` cache locked when performing both the height check and update in `prePopulateChartsData`.\r\nAdd thread-unsafe `height` and `update` functions for `chartDataCounter` so that the cache can be locked for both operations manually.\r\n\r\nThis partially resolves https://github.com/decred/dcrdata/issues/725.\r\n\r\nPreviously:\r\n\r\n```\r\n<connect to DBs>\r\n2018-11-13 17:05:16.015 [INF] EXPR: Mean Voting Blocks calculated: 7860\r\n2018-11-13 17:05:16.024 [INF] EXPR: Pre-populating the charts data. This may take a minute...\r\n2018-11-13 17:05:20.375 [INF] EXPR: Done Pre-populating the charts data\r\n<run sync>\r\n2018-11-13 17:05:23.439 [INF] DATD: All ready, at height 291870.\r\n2018-11-13 17:05:23.442 [INF] EXPR: Pre-populating the charts data. This may take a minute...\r\n2018-11-13 17:05:23.494 [DBG] EXPR: Got new block 291870 for the explorer.\r\n2018-11-13 17:05:23.494 [INF] EXPR: Signaling new block to 0 websocket clients.\r\n2018-11-13 17:05:23.496 [DBG] MEMP: mempoolDataCollector.Collect() completed in 1.491537ms\r\n2018-11-13 17:05:23.496 [INF] EXPR: Pre-populating the charts data. This may take a minute...\r\n2018-11-13 17:05:23.502 [DBG] EXPR: storeMempoolInfo() completed in 7.56529ms\r\n2018-11-13 17:05:27.607 [INF] EXPR: Done Pre-populating the charts data\r\n2018-11-13 17:05:27.827 [INF] EXPR: Done Pre-populating the charts data\r\n```\r\n\r\nThe charts data pre-population was run three times: once before sync, once on initial explorer.Store, and again unconditionally/manually after everything is up and running and final ensureSync is done.\r\n\r\nNow:\r\n\r\n```\r\n<no pre-populate before sync>\r\n2018-11-13 16:58:28.984 [DBG] EXPR: Got new block 291869 for the explorer.\r\n2018-11-13 16:58:28.984 [INF] EXPR: Pre-populating the charts data. This may take a minute...\r\n2018-11-13 16:58:28.984 [INF] EXPR: Signaling new block to 0 websocket clients.\r\n2018-11-13 16:58:28.986 [DBG] MEMP: mempoolDataCollector.Collect() completed in 1.720893ms\r\n2018-11-13 16:58:28.991 [DBG] EXPR: storeMempoolInfo() completed in 7.001131ms\r\n2018-11-13 16:58:33.255 [INF] EXPR: Done pre-populating the charts data.\r\n2018-11-13 16:58:33.255 [DBG] EXPR: Not updating charts data again for height 291869.\r\n```\r\n\r\nThere is no more pre-populate in explorer.New (when things wouldn't be syncd yet), and when `prePopulateChartsData` is called at the end of setup, it will return without querying the DB since the previous call to `prePopulateChartsData` in the initial `explore.Store` recorded the height and it is recognized as fresh data.","created_at":"2018-11-13T22:50:58Z","updated_at":"2018-11-14T16:43:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6d5f0fffec69f41ae58e7c5b8103c3d769865258","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1081515559,"node_id":"MDU6TGFiZWwxMDgxNTE1NTU5","url":"https://api.github.com/repos/decred/dcrdata/labels/bug-fix","name":"bug-fix","color":"f76cdb","default":false}],"milestone":{"url":"https://api.github.com/repos/decred/dcrdata/milestones/27","html_url":"https://github.com/decred/dcrdata/milestone/27","labels_url":"https://api.github.com/repos/decred/dcrdata/milestones/27/labels","id":3561187,"node_id":"MDk6TWlsZXN0b25lMzU2MTE4Nw==","number":27,"title":"3.1","description":null,"creator":{"login":"chappjc","id":9373513,"node_id":"MDQ6VXNlcjkzNzM1MTM=","avatar_url":"https://avatars1.githubusercontent.com/u/9373513?v=4","gravatar_id":"","url":"https://api.github.com/users/chappjc","html_url":"https://github.com/chappjc","followers_url":"https://api.github.com/users/chappjc/followers","following_url":"https://api.github.com/users/chappjc/following{/other_user}","gists_url":"https://api.github.com/users/chappjc/gists{/gist_id}","starred_url":"https://api.github.com/users/chappjc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chappjc/subscriptions","organizations_url":"https://api.github.com/users/chappjc/orgs","repos_url":"https://api.github.com/users/chappjc/repos","events_url":"https://api.github.com/users/chappjc/events{/privacy}","received_events_url":"https://api.github.com/users/chappjc/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":72,"state":"open","created_at":"2018-08-10T15:01:29Z","updated_at":"2018-11-13T23:02:37Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/decred/dcrdata/pulls/816/commits","review_comments_url":"https://api.github.com/repos/decred/dcrdata/pulls/816/comments","review_comment_url":"https://api.github.com/repos/decred/dcrdata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/decred/dcrdata/issues/816/comments","statuses_url":"https://api.github.com/repos/decred/dcrdata/statuses/37aacd515038814cbd0e5cf2f58009640beffb14","head":{"label":"chappjc:no-charts-prepop","ref":"no-charts-prepop","sha":"37aacd515038814cbd0e5cf2f58009640beffb14","user":{"login":"chappjc","id":9373513,"node_id":"MDQ6VXNlcjkzNzM1MTM=","avatar_url":"https://avatars1.githubusercontent.com/u/9373513?v=4","gravatar_id":"","url":"https://api.github.com/users/chappjc","html_url":"https://github.com/chappjc","followers_url":"https://api.github.com/users/chappjc/followers","following_url":"https://api.github.com/users/chappjc/following{/other_user}","gists_url":"https://api.github.com/users/chappjc/gists{/gist_id}","starred_url":"https://api.github.com/users/chappjc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chappjc/subscriptions","organizations_url":"https://api.github.com/users/chappjc/orgs","repos_url":"https://api.github.com/users/chappjc/repos","events_url":"https://api.github.com/users/chappjc/events{/privacy}","received_events_url":"https://api.github.com/users/chappjc/received_events","type":"User","site_admin":false},"repo":{"id":123041252,"node_id":"MDEwOlJlcG9zaXRvcnkxMjMwNDEyNTI=","name":"dcrdata","full_name":"chappjc/dcrdata","private":false,"owner":{"login":"chappjc","id":9373513,"node_id":"MDQ6VXNlcjkzNzM1MTM=","avatar_url":"https://avatars1.githubusercontent.com/u/9373513?v=4","gravatar_id":"","url":"https://api.github.com/users/chappjc","html_url":"https://github.com/chappjc","followers_url":"https://api.github.com/users/chappjc/followers","following_url":"https://api.github.com/users/chappjc/following{/other_user}","gists_url":"https://api.github.com/users/chappjc/gists{/gist_id}","starred_url":"https://api.github.com/users/chappjc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chappjc/subscriptions","organizations_url":"https://api.github.com/users/chappjc/orgs","repos_url":"https://api.github.com/users/chappjc/repos","events_url":"https://api.github.com/users/chappjc/events{/privacy}","received_events_url":"https://api.github.com/users/chappjc/received_events","type":"User","site_admin":false},"html_url":"https://github.com/chappjc/dcrdata","description":"Decred block explorer, with packages and apps for data collection and storage. Written in Go.","fork":true,"url":"https://api.github.com/repos/chappjc/dcrdata","forks_url":"https://api.github.com/repos/chappjc/dcrdata/forks","keys_url":"https://api.github.com/repos/chappjc/dcrdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chappjc/dcrdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chappjc/dcrdata/teams","hooks_url":"https://api.github.com/repos/chappjc/dcrdata/hooks","issue_events_url":"https://api.github.com/repos/chappjc/dcrdata/issues/events{/number}","events_url":"https://api.github.com/repos/chappjc/dcrdata/events","assignees_url":"https://api.github.com/repos/chappjc/dcrdata/assignees{/user}","branches_url":"https://api.github.com/repos/chappjc/dcrdata/branches{/branch}","tags_url":"https://api.github.com/repos/chappjc/dcrdata/tags","blobs_url":"https://api.github.com/repos/chappjc/dcrdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chappjc/dcrdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chappjc/dcrdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/chappjc/dcrdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chappjc/dcrdata/statuses/{sha}","languages_url":"https://api.github.com/repos/chappjc/dcrdata/languages","stargazers_url":"https://api.github.com/repos/chappjc/dcrdata/stargazers","contributors_url":"https://api.github.com/repos/chappjc/dcrdata/contributors","subscribers_url":"https://api.github.com/repos/chappjc/dcrdata/subscribers","subscription_url":"https://api.github.com/repos/chappjc/dcrdata/subscription","commits_url":"https://api.github.com/repos/chappjc/dcrdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/chappjc/dcrdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/chappjc/dcrdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/chappjc/dcrdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/chappjc/dcrdata/contents/{+path}","compare_url":"https://api.github.com/repos/chappjc/dcrdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chappjc/dcrdata/merges","archive_url":"https://api.github.com/repos/chappjc/dcrdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chappjc/dcrdata/downloads","issues_url":"https://api.github.com/repos/chappjc/dcrdata/issues{/number}","pulls_url":"https://api.github.com/repos/chappjc/dcrdata/pulls{/number}","milestones_url":"https://api.github.com/repos/chappjc/dcrdata/milestones{/number}","notifications_url":"https://api.github.com/repos/chappjc/dcrdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chappjc/dcrdata/labels{/name}","releases_url":"https://api.github.com/repos/chappjc/dcrdata/releases{/id}","deployments_url":"https://api.github.com/repos/chappjc/dcrdata/deployments","created_at":"2018-02-26T22:50:30Z","updated_at":"2018-02-26T22:50:32Z","pushed_at":"2018-11-14T16:03:47Z","git_url":"git://github.com/chappjc/dcrdata.git","ssh_url":"git@github.com:chappjc/dcrdata.git","clone_url":"https://github.com/chappjc/dcrdata.git","svn_url":"https://github.com/chappjc/dcrdata","homepage":"https://explorer.dcrdata.org/","size":9774,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"decred:master","ref":"master","sha":"986aeaa00ca1bdfc49eadacec42f301f530fbf4c","user":{"login":"decred","id":16297194,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2Mjk3MTk0","avatar_url":"https://avatars3.githubusercontent.com/u/16297194?v=4","gravatar_id":"","url":"https://api.github.com/users/decred","html_url":"https://github.com/decred","followers_url":"https://api.github.com/users/decred/followers","following_url":"https://api.github.com/users/decred/following{/other_user}","gists_url":"https://api.github.com/users/decred/gists{/gist_id}","starred_url":"https://api.github.com/users/decred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decred/subscriptions","organizations_url":"https://api.github.com/users/decred/orgs","repos_url":"https://api.github.com/users/decred/repos","events_url":"https://api.github.com/users/decred/events{/privacy}","received_events_url":"https://api.github.com/users/decred/received_events","type":"Organization","site_admin":false},"repo":{"id":82826361,"node_id":"MDEwOlJlcG9zaXRvcnk4MjgyNjM2MQ==","name":"dcrdata","full_name":"decred/dcrdata","private":false,"owner":{"login":"decred","id":16297194,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2Mjk3MTk0","avatar_url":"https://avatars3.githubusercontent.com/u/16297194?v=4","gravatar_id":"","url":"https://api.github.com/users/decred","html_url":"https://github.com/decred","followers_url":"https://api.github.com/users/decred/followers","following_url":"https://api.github.com/users/decred/following{/other_user}","gists_url":"https://api.github.com/users/decred/gists{/gist_id}","starred_url":"https://api.github.com/users/decred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decred/subscriptions","organizations_url":"https://api.github.com/users/decred/orgs","repos_url":"https://api.github.com/users/decred/repos","events_url":"https://api.github.com/users/decred/events{/privacy}","received_events_url":"https://api.github.com/users/decred/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/decred/dcrdata","description":"Decred block explorer, with packages and apps for data collection and storage. Written in Go.","fork":false,"url":"https://api.github.com/repos/decred/dcrdata","forks_url":"https://api.github.com/repos/decred/dcrdata/forks","keys_url":"https://api.github.com/repos/decred/dcrdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/decred/dcrdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/decred/dcrdata/teams","hooks_url":"https://api.github.com/repos/decred/dcrdata/hooks","issue_events_url":"https://api.github.com/repos/decred/dcrdata/issues/events{/number}","events_url":"https://api.github.com/repos/decred/dcrdata/events","assignees_url":"https://api.github.com/repos/decred/dcrdata/assignees{/user}","branches_url":"https://api.github.com/repos/decred/dcrdata/branches{/branch}","tags_url":"https://api.github.com/repos/decred/dcrdata/tags","blobs_url":"https://api.github.com/repos/decred/dcrdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/decred/dcrdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/decred/dcrdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/decred/dcrdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/decred/dcrdata/statuses/{sha}","languages_url":"https://api.github.com/repos/decred/dcrdata/languages","stargazers_url":"https://api.github.com/repos/decred/dcrdata/stargazers","contributors_url":"https://api.github.com/repos/decred/dcrdata/contributors","subscribers_url":"https://api.github.com/repos/decred/dcrdata/subscribers","subscription_url":"https://api.github.com/repos/decred/dcrdata/subscription","commits_url":"https://api.github.com/repos/decred/dcrdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/decred/dcrdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/decred/dcrdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/decred/dcrdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/decred/dcrdata/contents/{+path}","compare_url":"https://api.github.com/repos/decred/dcrdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/decred/dcrdata/merges","archive_url":"https://api.github.com/repos/decred/dcrdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/decred/dcrdata/downloads","issues_url":"https://api.github.com/repos/decred/dcrdata/issues{/number}","pulls_url":"https://api.github.com/repos/decred/dcrdata/pulls{/number}","milestones_url":"https://api.github.com/repos/decred/dcrdata/milestones{/number}","notifications_url":"https://api.github.com/repos/decred/dcrdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/decred/dcrdata/labels{/name}","releases_url":"https://api.github.com/repos/decred/dcrdata/releases{/id}","deployments_url":"https://api.github.com/repos/decred/dcrdata/deployments","created_at":"2017-02-22T16:24:53Z","updated_at":"2018-11-14T16:33:23Z","pushed_at":"2018-11-14T16:33:20Z","git_url":"git://github.com/decred/dcrdata.git","ssh_url":"git@github.com:decred/dcrdata.git","clone_url":"https://github.com/decred/dcrdata.git","svn_url":"https://github.com/decred/dcrdata","homepage":"https://explorer.dcrdata.org/","size":9708,"stargazers_count":59,"watchers_count":59,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":82,"mirror_url":null,"archived":false,"open_issues_count":86,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":82,"open_issues":86,"watchers":59,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/816"},"html":{"href":"https://github.com/decred/dcrdata/pull/816"},"issue":{"href":"https://api.github.com/repos/decred/dcrdata/issues/816"},"comments":{"href":"https://api.github.com/repos/decred/dcrdata/issues/816/comments"},"review_comments":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/816/comments"},"review_comment":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/816/commits"},"statuses":{"href":"https://api.github.com/repos/decred/dcrdata/statuses/37aacd515038814cbd0e5cf2f58009640beffb14"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"dmigwi"}}