{"action":"opened","number":699,"pull_request":{"url":"https://api.github.com/repos/decred/dcrdata/pulls/699","id":217382623,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MzgyNjIz","html_url":"https://github.com/decred/dcrdata/pull/699","diff_url":"https://github.com/decred/dcrdata/pull/699.diff","patch_url":"https://github.com/decred/dcrdata/pull/699.patch","issue_url":"https://api.github.com/repos/decred/dcrdata/issues/699","number":699,"state":"open","locked":false,"title":"Initial ctrl-c fixes","user":{"login":"papacarp","id":11194546,"node_id":"MDQ6VXNlcjExMTk0NTQ2","avatar_url":"https://avatars1.githubusercontent.com/u/11194546?v=4","gravatar_id":"","url":"https://api.github.com/users/papacarp","html_url":"https://github.com/papacarp","followers_url":"https://api.github.com/users/papacarp/followers","following_url":"https://api.github.com/users/papacarp/following{/other_user}","gists_url":"https://api.github.com/users/papacarp/gists{/gist_id}","starred_url":"https://api.github.com/users/papacarp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/papacarp/subscriptions","organizations_url":"https://api.github.com/users/papacarp/orgs","repos_url":"https://api.github.com/users/papacarp/repos","events_url":"https://api.github.com/users/papacarp/events{/privacy}","received_events_url":"https://api.github.com/users/papacarp/received_events","type":"User","site_admin":false},"body":"This PR addresses startup issues notably on windows that will corrupt the badger db.  Addresses issue #645 \r\n\r\n1.  Ctrl-C handler is moved earlier in main.go to insure its operational during stakedb load\r\n2.  Sprinkles in additional channel selects to allow exiting startup at safe times.\r\n3.  Modifies Ctrl-C handling to insure additional Ctrl-C's after the first one do not force an abrupt exit.\r\n\r\nTesting shows this eliminates corruption due to Ctrl-C on startup that I saw previously.  Examples of shutdown are shown below (4 ctrl-c's pressed in each case):\r\n\r\n```\r\n2018-09-21 12:24:03.281 [INF] RPCC: Established connection to RPC server localhost:9109\r\n2018-09-21 12:24:03.283 [INF] DATD: Connected to dcrd (JSON-RPC API v3.3.0) on MainNet\r\n2018-09-21 12:24:03.300 [INF] SKDB: Loading ticket pool DB. This may take a minute...\r\n2018-09-21 12:24:03.399 [INF] SKDB: Loading all ticket pool diffs...\r\n2018-09-21 12:24:07.018 [INF] DATD: CTRL+C hit.  Closing goroutines.\r\n2018-09-21 12:24:08.602 [INF] DATD: Shutdown signaled.  Already shutting down...\r\n2018-09-21 12:24:08.770 [INF] DATD: Shutdown signaled.  Already shutting down...\r\n2018-09-21 12:24:08.915 [INF] DATD: Shutdown signaled.  Already shutting down...\r\n2018-09-21 12:24:42.657 [DBG] SKDB: len(poolDiffs)=276412\r\n2018-09-21 12:24:42.657 [DBG] SKDB: poolDiffs[0].Height=1, poolDiffs[end].Height=276412\r\n2018-09-21 12:24:43.073 [DBG] SKDB: Opened existing stake db.\r\n2018-09-21 12:24:43.073 [INF] SKDB: Advancing ticket pool DB to tip via diffs...\r\n2018-09-21 12:24:43.970 [INF] SKDB: Pre-populating live ticket cache and computing pool value...\r\n2018-09-21 12:24:50.821 [INF] DATD: SQLite DB successfully opened: dcrdata.sqlt.db\r\n2018-09-21 12:24:50.913 [INF] DATD: Closing connection to dcrd.\r\n2018-09-21 12:24:50.914 [INF] DATD: Bye!\r\n```\r\n\r\n```\r\n2018-09-21 12:24:54.550 [INF] RPCC: Established connection to RPC server localhost:9109\r\n2018-09-21 12:24:54.553 [INF] DATD: Connected to dcrd (JSON-RPC API v3.3.0) on MainNet\r\n2018-09-21 12:24:54.559 [INF] SKDB: Loading ticket pool DB. This may take a minute...\r\n2018-09-21 12:24:54.674 [INF] SKDB: Loading all ticket pool diffs...\r\n2018-09-21 12:25:35.150 [DBG] SKDB: len(poolDiffs)=276412\r\n2018-09-21 12:25:35.150 [DBG] SKDB: poolDiffs[0].Height=1, poolDiffs[end].Height=276412\r\n2018-09-21 12:25:35.509 [DBG] SKDB: Opened existing stake db.\r\n2018-09-21 12:25:35.509 [INF] SKDB: Advancing ticket pool DB to tip via diffs...\r\n2018-09-21 12:25:36.498 [INF] SKDB: Pre-populating live ticket cache and computing pool value...\r\n2018-09-21 12:25:42.495 [INF] DATD: SQLite DB successfully opened: dcrdata.sqlt.db\r\n2018-09-21 12:25:42.664 [INF] PSQL: Pre-loading unspent ticket info for InsertVote optimization.\r\n2018-09-21 12:25:48.752 [INF] PSQL: Storing data for 43224 unspent tickets in cache.\r\n2018-09-21 12:25:48.806 [DBG] PSQL: Table vins: v3.5.3\r\n2018-09-21 12:25:48.807 [DBG] PSQL: Table agendas: v3.5.3\r\n2018-09-21 12:25:48.810 [DBG] PSQL: Table transactions: v3.5.3\r\n2018-09-21 12:25:48.812 [DBG] PSQL: Table misses: v3.5.3\r\n2018-09-21 12:25:48.813 [DBG] PSQL: Table addresses: v3.5.3\r\n2018-09-21 12:25:48.814 [DBG] PSQL: Table votes: v3.5.3\r\n2018-09-21 12:25:48.816 [DBG] PSQL: Table blocks: v3.5.3\r\n2018-09-21 12:25:48.817 [DBG] PSQL: Table tickets: v3.5.3\r\n2018-09-21 12:25:48.818 [DBG] PSQL: Table vouts: v3.5.3\r\n2018-09-21 12:25:48.823 [DBG] PSQL: Table block_chain: v3.5.3\r\n2018-09-21 12:25:48.824 [DBG] PSQL: All tables at correct version (3.5.3)\r\n2018-09-21 12:25:48.834 [DBG] DATD: Setting ticket pool cache capacity to 28 blocks\r\n2018-09-21 12:25:48.835 [DBG] SQLT: No pool info to load into cache\r\n2018-09-21 12:25:48.876 [DBG] EXPR: Organization address: Dcur2mcGjmENx4DhNqDctW5wJCVyT3Qeqkx\r\n2018-09-21 12:25:48.883 [INF] EXPR: Mean Voting Blocks calculated: 7860\r\n2018-09-21 12:25:48.933 [INF] EXPR: Pre-populating the charts data. This may take a minute...\r\n2018-09-21 12:25:51.218 [INF] DATD: CTRL+C hit.  Closing goroutines.\r\n2018-09-21 12:25:53.490 [INF] DATD: Shutdown signaled.  Already shutting down...\r\n2018-09-21 12:25:53.659 [INF] DATD: Shutdown signaled.  Already shutting down...\r\n2018-09-21 12:25:53.786 [INF] DATD: Shutdown signaled.  Already shutting down...\r\n2018-09-21 12:27:32.305 [INF] EXPR: Done Pre-populating the charts data\r\n2018-09-21 12:27:32.309 [INF] EXPR: Signals unsupported on windows\r\n2018-09-21 12:27:32.309 [INF] EXPR: Starting WebsocketHub run loop.\r\n2018-09-21 12:27:32.310 [INF] EXPR: Stopping mempool monitor\r\n2018-09-21 12:27:32.310 [INF] EXPR: Stopping websocket hub.\r\n2018-09-21 12:27:32.310 [ERR] EXPR: Do not send on stopPing channel, only close it.\r\n2018-09-21 12:27:32.494 [INF] DATD: Closing connection to dcrd.\r\n2018-09-21 12:27:32.495 [INF] DATD: Bye!\r\n```\r\n\r\nEventually I would like to see the ability to exit mid way through the stakedb loading and the chart data loading as these are each the longest events during startup.  However those should probably be a separate PR.","created_at":"2018-09-21T19:42:24Z","updated_at":"2018-09-21T19:42:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/decred/dcrdata/pulls/699/commits","review_comments_url":"https://api.github.com/repos/decred/dcrdata/pulls/699/comments","review_comment_url":"https://api.github.com/repos/decred/dcrdata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/decred/dcrdata/issues/699/comments","statuses_url":"https://api.github.com/repos/decred/dcrdata/statuses/9f16698e264ae779d967bbff7a479df8a8737cdc","head":{"label":"papacarp:ctrl-c","ref":"ctrl-c","sha":"9f16698e264ae779d967bbff7a479df8a8737cdc","user":{"login":"papacarp","id":11194546,"node_id":"MDQ6VXNlcjExMTk0NTQ2","avatar_url":"https://avatars1.githubusercontent.com/u/11194546?v=4","gravatar_id":"","url":"https://api.github.com/users/papacarp","html_url":"https://github.com/papacarp","followers_url":"https://api.github.com/users/papacarp/followers","following_url":"https://api.github.com/users/papacarp/following{/other_user}","gists_url":"https://api.github.com/users/papacarp/gists{/gist_id}","starred_url":"https://api.github.com/users/papacarp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/papacarp/subscriptions","organizations_url":"https://api.github.com/users/papacarp/orgs","repos_url":"https://api.github.com/users/papacarp/repos","events_url":"https://api.github.com/users/papacarp/events{/privacy}","received_events_url":"https://api.github.com/users/papacarp/received_events","type":"User","site_admin":false},"repo":{"id":127939400,"node_id":"MDEwOlJlcG9zaXRvcnkxMjc5Mzk0MDA=","name":"dcrdata","full_name":"papacarp/dcrdata","private":false,"owner":{"login":"papacarp","id":11194546,"node_id":"MDQ6VXNlcjExMTk0NTQ2","avatar_url":"https://avatars1.githubusercontent.com/u/11194546?v=4","gravatar_id":"","url":"https://api.github.com/users/papacarp","html_url":"https://github.com/papacarp","followers_url":"https://api.github.com/users/papacarp/followers","following_url":"https://api.github.com/users/papacarp/following{/other_user}","gists_url":"https://api.github.com/users/papacarp/gists{/gist_id}","starred_url":"https://api.github.com/users/papacarp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/papacarp/subscriptions","organizations_url":"https://api.github.com/users/papacarp/orgs","repos_url":"https://api.github.com/users/papacarp/repos","events_url":"https://api.github.com/users/papacarp/events{/privacy}","received_events_url":"https://api.github.com/users/papacarp/received_events","type":"User","site_admin":false},"html_url":"https://github.com/papacarp/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/papacarp/dcrdata","forks_url":"https://api.github.com/repos/papacarp/dcrdata/forks","keys_url":"https://api.github.com/repos/papacarp/dcrdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/papacarp/dcrdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/papacarp/dcrdata/teams","hooks_url":"https://api.github.com/repos/papacarp/dcrdata/hooks","issue_events_url":"https://api.github.com/repos/papacarp/dcrdata/issues/events{/number}","events_url":"https://api.github.com/repos/papacarp/dcrdata/events","assignees_url":"https://api.github.com/repos/papacarp/dcrdata/assignees{/user}","branches_url":"https://api.github.com/repos/papacarp/dcrdata/branches{/branch}","tags_url":"https://api.github.com/repos/papacarp/dcrdata/tags","blobs_url":"https://api.github.com/repos/papacarp/dcrdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/papacarp/dcrdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/papacarp/dcrdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/papacarp/dcrdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/papacarp/dcrdata/statuses/{sha}","languages_url":"https://api.github.com/repos/papacarp/dcrdata/languages","stargazers_url":"https://api.github.com/repos/papacarp/dcrdata/stargazers","contributors_url":"https://api.github.com/repos/papacarp/dcrdata/contributors","subscribers_url":"https://api.github.com/repos/papacarp/dcrdata/subscribers","subscription_url":"https://api.github.com/repos/papacarp/dcrdata/subscription","commits_url":"https://api.github.com/repos/papacarp/dcrdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/papacarp/dcrdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/papacarp/dcrdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/papacarp/dcrdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/papacarp/dcrdata/contents/{+path}","compare_url":"https://api.github.com/repos/papacarp/dcrdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/papacarp/dcrdata/merges","archive_url":"https://api.github.com/repos/papacarp/dcrdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/papacarp/dcrdata/downloads","issues_url":"https://api.github.com/repos/papacarp/dcrdata/issues{/number}","pulls_url":"https://api.github.com/repos/papacarp/dcrdata/pulls{/number}","milestones_url":"https://api.github.com/repos/papacarp/dcrdata/milestones{/number}","notifications_url":"https://api.github.com/repos/papacarp/dcrdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/papacarp/dcrdata/labels{/name}","releases_url":"https://api.github.com/repos/papacarp/dcrdata/releases{/id}","deployments_url":"https://api.github.com/repos/papacarp/dcrdata/deployments","created_at":"2018-04-03T16:50:00Z","updated_at":"2018-09-21T13:57:22Z","pushed_at":"2018-09-21T19:33:03Z","git_url":"git://github.com/papacarp/dcrdata.git","ssh_url":"git@github.com:papacarp/dcrdata.git","clone_url":"https://github.com/papacarp/dcrdata.git","svn_url":"https://github.com/papacarp/dcrdata","homepage":"https://explorer.dcrdata.org/","size":8487,"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":"60d033d44becfc253881d97befa34d4f65907ef6","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-09-21T00:20:37Z","pushed_at":"2018-09-21T18:32:18Z","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":8540,"stargazers_count":56,"watchers_count":56,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":75,"mirror_url":null,"archived":false,"open_issues_count":87,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":75,"open_issues":87,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/699"},"html":{"href":"https://github.com/decred/dcrdata/pull/699"},"issue":{"href":"https://api.github.com/repos/decred/dcrdata/issues/699"},"comments":{"href":"https://api.github.com/repos/decred/dcrdata/issues/699/comments"},"review_comments":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/699/comments"},"review_comment":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/decred/dcrdata/pulls/699/commits"},"statuses":{"href":"https://api.github.com/repos/decred/dcrdata/statuses/9f16698e264ae779d967bbff7a479df8a8737cdc"}},"author_association":"MEMBER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":57,"deletions":16,"changed_files":1}}
{"actor":{"display_login":"papacarp"}}