{"action":"created","comment":{"url":"https://api.github.com/repos/status-im/open-bounty/pulls/comments/175261419","pull_request_review_id":104769656,"id":175261419,"diff_hunk":"@@ -26,24 +28,30 @@\n (defn auto-gas-price? [] (env :auto-gas-price false))\n (defn offline-signing? [] (env :offline-signing true))\n \n+(def web3j-obj (atom nil))\n+(def creds-obj (atom nil))\n+\n (defn wallet-file-path []\n   (env :eth-wallet-file))\n \n (defn wallet-password []\n   (env :eth-password))\n \n-(defn creds []\n-  (let [password  (wallet-password)\n-        file-path (wallet-file-path)]\n-    (if (and password file-path)\n-      (WalletUtils/loadCredentials\n-       password\n-       file-path)\n-      (throw (ex-info \"Make sure you provided proper credentials in appropriate resources/config.edn\"\n-                      {:password password :file-path file-path})))))\n-\n (defn create-web3j []\n-  (Web3j/build (HttpService. (eth-rpc-url))))\n+ (or @web3j-obj\n+      (swap! web3j-obj (constantly (Web3j/build (HttpService. (eth-rpc-url)))))))\n+\n+(defn creds []\n+  (or @creds-obj\n+      (let [password  (wallet-password)\n+            file-path (wallet-file-path)]\n+        (if (and password file-path)\n+          (swap! creds-obj\n+                 (constantly (WalletUtils/loadCredentials\n+                               password\n+                               file-path)))\n+          (throw (ex-info \"Make sure you provided proper credentials in appropriate resources/config.edn\"\n+                          {:password password :file-path file-path}))))))","path":"src/clj/commiteth/eth/core.clj","position":49,"original_position":49,"commit_id":"cf79ea7d3b81e39fae292736504b53b7cb622c77","original_commit_id":"cf79ea7d3b81e39fae292736504b53b7cb622c77","user":{"login":"martinklepsch","id":97496,"avatar_url":"https://avatars3.githubusercontent.com/u/97496?v=4","gravatar_id":"","url":"https://api.github.com/users/martinklepsch","html_url":"https://github.com/martinklepsch","followers_url":"https://api.github.com/users/martinklepsch/followers","following_url":"https://api.github.com/users/martinklepsch/following{/other_user}","gists_url":"https://api.github.com/users/martinklepsch/gists{/gist_id}","starred_url":"https://api.github.com/users/martinklepsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinklepsch/subscriptions","organizations_url":"https://api.github.com/users/martinklepsch/orgs","repos_url":"https://api.github.com/users/martinklepsch/repos","events_url":"https://api.github.com/users/martinklepsch/events{/privacy}","received_events_url":"https://api.github.com/users/martinklepsch/received_events","type":"User","site_admin":false},"body":"I was actually thinking of Clojure.core functions memoize and defonce. Another alternative might be treating these objects as 'mount' components ","created_at":"2018-03-17T15:39:42Z","updated_at":"2018-03-17T15:39:42Z","html_url":"https://github.com/status-im/open-bounty/pull/360#discussion_r175261419","pull_request_url":"https://api.github.com/repos/status-im/open-bounty/pulls/360","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/status-im/open-bounty/pulls/comments/175261419"},"html":{"href":"https://github.com/status-im/open-bounty/pull/360#discussion_r175261419"},"pull_request":{"href":"https://api.github.com/repos/status-im/open-bounty/pulls/360"}},"in_reply_to_id":175261026},"pull_request":{"url":"https://api.github.com/repos/status-im/open-bounty/pulls/360","id":175705120,"html_url":"https://github.com/status-im/open-bounty/pull/360","diff_url":"https://github.com/status-im/open-bounty/pull/360.diff","patch_url":"https://github.com/status-im/open-bounty/pull/360.patch","issue_url":"https://api.github.com/repos/status-im/open-bounty/issues/360","number":360,"state":"open","locked":false,"title":"Reduce payout confirmation wait times","user":{"login":"siphiuel","id":1019573,"avatar_url":"https://avatars0.githubusercontent.com/u/1019573?v=4","gravatar_id":"","url":"https://api.github.com/users/siphiuel","html_url":"https://github.com/siphiuel","followers_url":"https://api.github.com/users/siphiuel/followers","following_url":"https://api.github.com/users/siphiuel/following{/other_user}","gists_url":"https://api.github.com/users/siphiuel/gists{/gist_id}","starred_url":"https://api.github.com/users/siphiuel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siphiuel/subscriptions","organizations_url":"https://api.github.com/users/siphiuel/orgs","repos_url":"https://api.github.com/users/siphiuel/repos","events_url":"https://api.github.com/users/siphiuel/events{/privacy}","received_events_url":"https://api.github.com/users/siphiuel/received_events","type":"User","site_admin":false},"body":"Fixes #353 \r\n\r\nThis fix does the following:\r\n  - Move balances updates to 10-min scheduler threads\r\n  - Cache return values of `eth.core/create-web3j` and `eth.core/creds` in an atom, reset these when mounting corresponding state\r\n  - Add Tufte macros for profiling, can be removed afterwards","created_at":"2018-03-17T15:15:08Z","updated_at":"2018-03-17T15:39:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a94cfa72cfa29f715c10107df00d209234b932cd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/status-im/open-bounty/pulls/360/commits","review_comments_url":"https://api.github.com/repos/status-im/open-bounty/pulls/360/comments","review_comment_url":"https://api.github.com/repos/status-im/open-bounty/pulls/comments{/number}","comments_url":"https://api.github.com/repos/status-im/open-bounty/issues/360/comments","statuses_url":"https://api.github.com/repos/status-im/open-bounty/statuses/cf79ea7d3b81e39fae292736504b53b7cb622c77","head":{"label":"status-im:fix/reduce-confirm-wait-time-353","ref":"fix/reduce-confirm-wait-time-353","sha":"cf79ea7d3b81e39fae292736504b53b7cb622c77","user":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"repo":{"id":65593470,"name":"open-bounty","full_name":"status-im/open-bounty","owner":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/status-im/open-bounty","description":"Whosoever commiteth code, abideth issues & entrusts maintainers - shall receiveth reward","fork":false,"url":"https://api.github.com/repos/status-im/open-bounty","forks_url":"https://api.github.com/repos/status-im/open-bounty/forks","keys_url":"https://api.github.com/repos/status-im/open-bounty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/status-im/open-bounty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/status-im/open-bounty/teams","hooks_url":"https://api.github.com/repos/status-im/open-bounty/hooks","issue_events_url":"https://api.github.com/repos/status-im/open-bounty/issues/events{/number}","events_url":"https://api.github.com/repos/status-im/open-bounty/events","assignees_url":"https://api.github.com/repos/status-im/open-bounty/assignees{/user}","branches_url":"https://api.github.com/repos/status-im/open-bounty/branches{/branch}","tags_url":"https://api.github.com/repos/status-im/open-bounty/tags","blobs_url":"https://api.github.com/repos/status-im/open-bounty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/status-im/open-bounty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/status-im/open-bounty/git/refs{/sha}","trees_url":"https://api.github.com/repos/status-im/open-bounty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/status-im/open-bounty/statuses/{sha}","languages_url":"https://api.github.com/repos/status-im/open-bounty/languages","stargazers_url":"https://api.github.com/repos/status-im/open-bounty/stargazers","contributors_url":"https://api.github.com/repos/status-im/open-bounty/contributors","subscribers_url":"https://api.github.com/repos/status-im/open-bounty/subscribers","subscription_url":"https://api.github.com/repos/status-im/open-bounty/subscription","commits_url":"https://api.github.com/repos/status-im/open-bounty/commits{/sha}","git_commits_url":"https://api.github.com/repos/status-im/open-bounty/git/commits{/sha}","comments_url":"https://api.github.com/repos/status-im/open-bounty/comments{/number}","issue_comment_url":"https://api.github.com/repos/status-im/open-bounty/issues/comments{/number}","contents_url":"https://api.github.com/repos/status-im/open-bounty/contents/{+path}","compare_url":"https://api.github.com/repos/status-im/open-bounty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/status-im/open-bounty/merges","archive_url":"https://api.github.com/repos/status-im/open-bounty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/status-im/open-bounty/downloads","issues_url":"https://api.github.com/repos/status-im/open-bounty/issues{/number}","pulls_url":"https://api.github.com/repos/status-im/open-bounty/pulls{/number}","milestones_url":"https://api.github.com/repos/status-im/open-bounty/milestones{/number}","notifications_url":"https://api.github.com/repos/status-im/open-bounty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/status-im/open-bounty/labels{/name}","releases_url":"https://api.github.com/repos/status-im/open-bounty/releases{/id}","deployments_url":"https://api.github.com/repos/status-im/open-bounty/deployments","created_at":"2016-08-13T01:44:08Z","updated_at":"2018-03-16T10:46:21Z","pushed_at":"2018-03-17T15:15:09Z","git_url":"git://github.com/status-im/open-bounty.git","ssh_url":"git@github.com:status-im/open-bounty.git","clone_url":"https://github.com/status-im/open-bounty.git","svn_url":"https://github.com/status-im/open-bounty","homepage":"https://openbounty.status.im/","size":5675,"stargazers_count":115,"watchers_count":115,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"archived":false,"open_issues_count":93,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":33,"open_issues":93,"watchers":115,"default_branch":"develop"}},"base":{"label":"status-im:develop","ref":"develop","sha":"d98b26a16c0db57bee68295d951f6db8266fd756","user":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"repo":{"id":65593470,"name":"open-bounty","full_name":"status-im/open-bounty","owner":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/status-im/open-bounty","description":"Whosoever commiteth code, abideth issues & entrusts maintainers - shall receiveth reward","fork":false,"url":"https://api.github.com/repos/status-im/open-bounty","forks_url":"https://api.github.com/repos/status-im/open-bounty/forks","keys_url":"https://api.github.com/repos/status-im/open-bounty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/status-im/open-bounty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/status-im/open-bounty/teams","hooks_url":"https://api.github.com/repos/status-im/open-bounty/hooks","issue_events_url":"https://api.github.com/repos/status-im/open-bounty/issues/events{/number}","events_url":"https://api.github.com/repos/status-im/open-bounty/events","assignees_url":"https://api.github.com/repos/status-im/open-bounty/assignees{/user}","branches_url":"https://api.github.com/repos/status-im/open-bounty/branches{/branch}","tags_url":"https://api.github.com/repos/status-im/open-bounty/tags","blobs_url":"https://api.github.com/repos/status-im/open-bounty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/status-im/open-bounty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/status-im/open-bounty/git/refs{/sha}","trees_url":"https://api.github.com/repos/status-im/open-bounty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/status-im/open-bounty/statuses/{sha}","languages_url":"https://api.github.com/repos/status-im/open-bounty/languages","stargazers_url":"https://api.github.com/repos/status-im/open-bounty/stargazers","contributors_url":"https://api.github.com/repos/status-im/open-bounty/contributors","subscribers_url":"https://api.github.com/repos/status-im/open-bounty/subscribers","subscription_url":"https://api.github.com/repos/status-im/open-bounty/subscription","commits_url":"https://api.github.com/repos/status-im/open-bounty/commits{/sha}","git_commits_url":"https://api.github.com/repos/status-im/open-bounty/git/commits{/sha}","comments_url":"https://api.github.com/repos/status-im/open-bounty/comments{/number}","issue_comment_url":"https://api.github.com/repos/status-im/open-bounty/issues/comments{/number}","contents_url":"https://api.github.com/repos/status-im/open-bounty/contents/{+path}","compare_url":"https://api.github.com/repos/status-im/open-bounty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/status-im/open-bounty/merges","archive_url":"https://api.github.com/repos/status-im/open-bounty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/status-im/open-bounty/downloads","issues_url":"https://api.github.com/repos/status-im/open-bounty/issues{/number}","pulls_url":"https://api.github.com/repos/status-im/open-bounty/pulls{/number}","milestones_url":"https://api.github.com/repos/status-im/open-bounty/milestones{/number}","notifications_url":"https://api.github.com/repos/status-im/open-bounty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/status-im/open-bounty/labels{/name}","releases_url":"https://api.github.com/repos/status-im/open-bounty/releases{/id}","deployments_url":"https://api.github.com/repos/status-im/open-bounty/deployments","created_at":"2016-08-13T01:44:08Z","updated_at":"2018-03-16T10:46:21Z","pushed_at":"2018-03-17T15:15:09Z","git_url":"git://github.com/status-im/open-bounty.git","ssh_url":"git@github.com:status-im/open-bounty.git","clone_url":"https://github.com/status-im/open-bounty.git","svn_url":"https://github.com/status-im/open-bounty","homepage":"https://openbounty.status.im/","size":5675,"stargazers_count":115,"watchers_count":115,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"archived":false,"open_issues_count":93,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":33,"open_issues":93,"watchers":115,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/status-im/open-bounty/pulls/360"},"html":{"href":"https://github.com/status-im/open-bounty/pull/360"},"issue":{"href":"https://api.github.com/repos/status-im/open-bounty/issues/360"},"comments":{"href":"https://api.github.com/repos/status-im/open-bounty/issues/360/comments"},"review_comments":{"href":"https://api.github.com/repos/status-im/open-bounty/pulls/360/comments"},"review_comment":{"href":"https://api.github.com/repos/status-im/open-bounty/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/status-im/open-bounty/pulls/360/commits"},"statuses":{"href":"https://api.github.com/repos/status-im/open-bounty/statuses/cf79ea7d3b81e39fae292736504b53b7cb622c77"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"martinklepsch"}}