{"action":"created","comment":{"url":"https://api.github.com/repos/softwerkskammer/Agora/pulls/comments/78297961","id":78297961,"diff_hunk":"@@ -26,63 +26,64 @@ function keyFor(url, key) {\n   return url + '_' + key;\n }\n \n+function getGlobalEventStoreForWriting(url, callback) {\n+  const cacheKey = keyFor(url, GLOBAL_EVENT_STORE_FOR_WRITING);\n+  const cachedStore = cache.get(cacheKey);\n+  if (cachedStore) {\n+    return callback(null, cachedStore);\n+  }\n+\n+  eventstore.getEventStore(url, function (err, eventStore) {\n+    if (err || !eventStore) { return callback(err); }\n+    const cachedWhileFetching = cache.get(cacheKey);\n+    if (cachedWhileFetching) {\n+      return callback(null, cachedWhileFetching);\n+    }\n+    cache.set(cacheKey, eventStore);\n+    callback(null, eventStore);\n+  });\n+}\n+\n function getReadModel(url, key, ReadModel, callback) {\n   const cacheKey = keyFor(url, key);\n-  var cachedModel = cache.get(cacheKey);\n+  const cachedModel = cache.get(cacheKey);\n   if (cachedModel) {\n     return callback(null, cachedModel);\n   }\n-  eventstore.getEventStore(url, function (err, eventStore) {\n+  getGlobalEventStoreForWriting(url, function (err, eventStore) {\n     // for the read models, there must be an eventstore already:\n     if (err || !eventStore) { return callback(err); }\n-    const newModel = new ReadModel(eventStore);\n-    var cachedModel2 = cache.get(cacheKey);\n-    if (cachedModel2) {\n-      return callback(null, cachedModel2);\n+    const cachedWhileFetching = cache.get(cacheKey);\n+    if (cachedWhileFetching) {\n+      return callback(null, cachedWhileFetching);\n     }\n+    const newModel = new ReadModel(eventStore);\n     cache.set(cacheKey, newModel);\n     callback(null, newModel);\n   });\n }","path":"socrates/lib/eventstore/eventstoreService.js","position":45,"original_position":45,"commit_id":"f165a1ff1c4d8df2d44d5b5990fb0558f0fb95ea","original_commit_id":"f165a1ff1c4d8df2d44d5b5990fb0558f0fb95ea","user":{"login":"leider","id":450708,"avatar_url":"https://avatars.githubusercontent.com/u/450708?v=3","gravatar_id":"","url":"https://api.github.com/users/leider","html_url":"https://github.com/leider","followers_url":"https://api.github.com/users/leider/followers","following_url":"https://api.github.com/users/leider/following{/other_user}","gists_url":"https://api.github.com/users/leider/gists{/gist_id}","starred_url":"https://api.github.com/users/leider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leider/subscriptions","organizations_url":"https://api.github.com/users/leider/orgs","repos_url":"https://api.github.com/users/leider/repos","events_url":"https://api.github.com/users/leider/events{/privacy}","received_events_url":"https://api.github.com/users/leider/received_events","type":"User","site_admin":false},"body":"viel klarer jetzt","created_at":"2016-09-11T16:23:36Z","updated_at":"2016-09-11T16:23:36Z","html_url":"https://github.com/softwerkskammer/Agora/pull/1119#discussion_r78297961","pull_request_url":"https://api.github.com/repos/softwerkskammer/Agora/pulls/1119","_links":{"self":{"href":"https://api.github.com/repos/softwerkskammer/Agora/pulls/comments/78297961"},"html":{"href":"https://github.com/softwerkskammer/Agora/pull/1119#discussion_r78297961"},"pull_request":{"href":"https://api.github.com/repos/softwerkskammer/Agora/pulls/1119"}}},"pull_request":{"url":"https://api.github.com/repos/softwerkskammer/Agora/pulls/1119","id":84790260,"html_url":"https://github.com/softwerkskammer/Agora/pull/1119","diff_url":"https://github.com/softwerkskammer/Agora/pull/1119.diff","patch_url":"https://github.com/softwerkskammer/Agora/pull/1119.patch","issue_url":"https://api.github.com/repos/softwerkskammer/Agora/issues/1119","number":1119,"state":"open","locked":false,"title":"Unification of event lists","user":{"login":"NicoleRauch","id":436499,"avatar_url":"https://avatars.githubusercontent.com/u/436499?v=3","gravatar_id":"","url":"https://api.github.com/users/NicoleRauch","html_url":"https://github.com/NicoleRauch","followers_url":"https://api.github.com/users/NicoleRauch/followers","following_url":"https://api.github.com/users/NicoleRauch/following{/other_user}","gists_url":"https://api.github.com/users/NicoleRauch/gists{/gist_id}","starred_url":"https://api.github.com/users/NicoleRauch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicoleRauch/subscriptions","organizations_url":"https://api.github.com/users/NicoleRauch/orgs","repos_url":"https://api.github.com/users/NicoleRauch/repos","events_url":"https://api.github.com/users/NicoleRauch/events{/privacy}","received_events_url":"https://api.github.com/users/NicoleRauch/received_events","type":"User","site_admin":false},"body":"Now all events are stored in the same list. **ATTENTION**: Requires DB migration on deploy. (Shut down SoCraTes for this pls.)","created_at":"2016-09-11T16:03:18Z","updated_at":"2016-09-11T16:23:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e887601a561db50c06a1311d1d68b283c89a4352","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/softwerkskammer/Agora/pulls/1119/commits","review_comments_url":"https://api.github.com/repos/softwerkskammer/Agora/pulls/1119/comments","review_comment_url":"https://api.github.com/repos/softwerkskammer/Agora/pulls/comments{/number}","comments_url":"https://api.github.com/repos/softwerkskammer/Agora/issues/1119/comments","statuses_url":"https://api.github.com/repos/softwerkskammer/Agora/statuses/f165a1ff1c4d8df2d44d5b5990fb0558f0fb95ea","head":{"label":"NicoleRauch:master","ref":"master","sha":"f165a1ff1c4d8df2d44d5b5990fb0558f0fb95ea","user":{"login":"NicoleRauch","id":436499,"avatar_url":"https://avatars.githubusercontent.com/u/436499?v=3","gravatar_id":"","url":"https://api.github.com/users/NicoleRauch","html_url":"https://github.com/NicoleRauch","followers_url":"https://api.github.com/users/NicoleRauch/followers","following_url":"https://api.github.com/users/NicoleRauch/following{/other_user}","gists_url":"https://api.github.com/users/NicoleRauch/gists{/gist_id}","starred_url":"https://api.github.com/users/NicoleRauch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicoleRauch/subscriptions","organizations_url":"https://api.github.com/users/NicoleRauch/orgs","repos_url":"https://api.github.com/users/NicoleRauch/repos","events_url":"https://api.github.com/users/NicoleRauch/events{/privacy}","received_events_url":"https://api.github.com/users/NicoleRauch/received_events","type":"User","site_admin":false},"repo":{"id":9099256,"name":"Agora","full_name":"NicoleRauch/Agora","owner":{"login":"NicoleRauch","id":436499,"avatar_url":"https://avatars.githubusercontent.com/u/436499?v=3","gravatar_id":"","url":"https://api.github.com/users/NicoleRauch","html_url":"https://github.com/NicoleRauch","followers_url":"https://api.github.com/users/NicoleRauch/followers","following_url":"https://api.github.com/users/NicoleRauch/following{/other_user}","gists_url":"https://api.github.com/users/NicoleRauch/gists{/gist_id}","starred_url":"https://api.github.com/users/NicoleRauch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicoleRauch/subscriptions","organizations_url":"https://api.github.com/users/NicoleRauch/orgs","repos_url":"https://api.github.com/users/NicoleRauch/repos","events_url":"https://api.github.com/users/NicoleRauch/events{/privacy}","received_events_url":"https://api.github.com/users/NicoleRauch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NicoleRauch/Agora","description":"Hier wird's ernst :-)","fork":true,"url":"https://api.github.com/repos/NicoleRauch/Agora","forks_url":"https://api.github.com/repos/NicoleRauch/Agora/forks","keys_url":"https://api.github.com/repos/NicoleRauch/Agora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NicoleRauch/Agora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NicoleRauch/Agora/teams","hooks_url":"https://api.github.com/repos/NicoleRauch/Agora/hooks","issue_events_url":"https://api.github.com/repos/NicoleRauch/Agora/issues/events{/number}","events_url":"https://api.github.com/repos/NicoleRauch/Agora/events","assignees_url":"https://api.github.com/repos/NicoleRauch/Agora/assignees{/user}","branches_url":"https://api.github.com/repos/NicoleRauch/Agora/branches{/branch}","tags_url":"https://api.github.com/repos/NicoleRauch/Agora/tags","blobs_url":"https://api.github.com/repos/NicoleRauch/Agora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NicoleRauch/Agora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NicoleRauch/Agora/git/refs{/sha}","trees_url":"https://api.github.com/repos/NicoleRauch/Agora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NicoleRauch/Agora/statuses/{sha}","languages_url":"https://api.github.com/repos/NicoleRauch/Agora/languages","stargazers_url":"https://api.github.com/repos/NicoleRauch/Agora/stargazers","contributors_url":"https://api.github.com/repos/NicoleRauch/Agora/contributors","subscribers_url":"https://api.github.com/repos/NicoleRauch/Agora/subscribers","subscription_url":"https://api.github.com/repos/NicoleRauch/Agora/subscription","commits_url":"https://api.github.com/repos/NicoleRauch/Agora/commits{/sha}","git_commits_url":"https://api.github.com/repos/NicoleRauch/Agora/git/commits{/sha}","comments_url":"https://api.github.com/repos/NicoleRauch/Agora/comments{/number}","issue_comment_url":"https://api.github.com/repos/NicoleRauch/Agora/issues/comments{/number}","contents_url":"https://api.github.com/repos/NicoleRauch/Agora/contents/{+path}","compare_url":"https://api.github.com/repos/NicoleRauch/Agora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NicoleRauch/Agora/merges","archive_url":"https://api.github.com/repos/NicoleRauch/Agora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NicoleRauch/Agora/downloads","issues_url":"https://api.github.com/repos/NicoleRauch/Agora/issues{/number}","pulls_url":"https://api.github.com/repos/NicoleRauch/Agora/pulls{/number}","milestones_url":"https://api.github.com/repos/NicoleRauch/Agora/milestones{/number}","notifications_url":"https://api.github.com/repos/NicoleRauch/Agora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NicoleRauch/Agora/labels{/name}","releases_url":"https://api.github.com/repos/NicoleRauch/Agora/releases{/id}","deployments_url":"https://api.github.com/repos/NicoleRauch/Agora/deployments","created_at":"2013-03-29T13:53:38Z","updated_at":"2016-08-28T13:53:02Z","pushed_at":"2016-09-11T15:44:35Z","git_url":"git://github.com/NicoleRauch/Agora.git","ssh_url":"git@github.com:NicoleRauch/Agora.git","clone_url":"https://github.com/NicoleRauch/Agora.git","svn_url":"https://github.com/NicoleRauch/Agora","homepage":null,"size":19865,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"softwerkskammer:master","ref":"master","sha":"53fdd0d649a6131529dc07cc882db4c4108f8423","user":{"login":"softwerkskammer","id":1238207,"avatar_url":"https://avatars.githubusercontent.com/u/1238207?v=3","gravatar_id":"","url":"https://api.github.com/users/softwerkskammer","html_url":"https://github.com/softwerkskammer","followers_url":"https://api.github.com/users/softwerkskammer/followers","following_url":"https://api.github.com/users/softwerkskammer/following{/other_user}","gists_url":"https://api.github.com/users/softwerkskammer/gists{/gist_id}","starred_url":"https://api.github.com/users/softwerkskammer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwerkskammer/subscriptions","organizations_url":"https://api.github.com/users/softwerkskammer/orgs","repos_url":"https://api.github.com/users/softwerkskammer/repos","events_url":"https://api.github.com/users/softwerkskammer/events{/privacy}","received_events_url":"https://api.github.com/users/softwerkskammer/received_events","type":"Organization","site_admin":false},"repo":{"id":8785436,"name":"Agora","full_name":"softwerkskammer/Agora","owner":{"login":"softwerkskammer","id":1238207,"avatar_url":"https://avatars.githubusercontent.com/u/1238207?v=3","gravatar_id":"","url":"https://api.github.com/users/softwerkskammer","html_url":"https://github.com/softwerkskammer","followers_url":"https://api.github.com/users/softwerkskammer/followers","following_url":"https://api.github.com/users/softwerkskammer/following{/other_user}","gists_url":"https://api.github.com/users/softwerkskammer/gists{/gist_id}","starred_url":"https://api.github.com/users/softwerkskammer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwerkskammer/subscriptions","organizations_url":"https://api.github.com/users/softwerkskammer/orgs","repos_url":"https://api.github.com/users/softwerkskammer/repos","events_url":"https://api.github.com/users/softwerkskammer/events{/privacy}","received_events_url":"https://api.github.com/users/softwerkskammer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/softwerkskammer/Agora","description":"Die Software für die Plattform der Softwerkskammer","fork":false,"url":"https://api.github.com/repos/softwerkskammer/Agora","forks_url":"https://api.github.com/repos/softwerkskammer/Agora/forks","keys_url":"https://api.github.com/repos/softwerkskammer/Agora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/softwerkskammer/Agora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/softwerkskammer/Agora/teams","hooks_url":"https://api.github.com/repos/softwerkskammer/Agora/hooks","issue_events_url":"https://api.github.com/repos/softwerkskammer/Agora/issues/events{/number}","events_url":"https://api.github.com/repos/softwerkskammer/Agora/events","assignees_url":"https://api.github.com/repos/softwerkskammer/Agora/assignees{/user}","branches_url":"https://api.github.com/repos/softwerkskammer/Agora/branches{/branch}","tags_url":"https://api.github.com/repos/softwerkskammer/Agora/tags","blobs_url":"https://api.github.com/repos/softwerkskammer/Agora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/softwerkskammer/Agora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/softwerkskammer/Agora/git/refs{/sha}","trees_url":"https://api.github.com/repos/softwerkskammer/Agora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/softwerkskammer/Agora/statuses/{sha}","languages_url":"https://api.github.com/repos/softwerkskammer/Agora/languages","stargazers_url":"https://api.github.com/repos/softwerkskammer/Agora/stargazers","contributors_url":"https://api.github.com/repos/softwerkskammer/Agora/contributors","subscribers_url":"https://api.github.com/repos/softwerkskammer/Agora/subscribers","subscription_url":"https://api.github.com/repos/softwerkskammer/Agora/subscription","commits_url":"https://api.github.com/repos/softwerkskammer/Agora/commits{/sha}","git_commits_url":"https://api.github.com/repos/softwerkskammer/Agora/git/commits{/sha}","comments_url":"https://api.github.com/repos/softwerkskammer/Agora/comments{/number}","issue_comment_url":"https://api.github.com/repos/softwerkskammer/Agora/issues/comments{/number}","contents_url":"https://api.github.com/repos/softwerkskammer/Agora/contents/{+path}","compare_url":"https://api.github.com/repos/softwerkskammer/Agora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/softwerkskammer/Agora/merges","archive_url":"https://api.github.com/repos/softwerkskammer/Agora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/softwerkskammer/Agora/downloads","issues_url":"https://api.github.com/repos/softwerkskammer/Agora/issues{/number}","pulls_url":"https://api.github.com/repos/softwerkskammer/Agora/pulls{/number}","milestones_url":"https://api.github.com/repos/softwerkskammer/Agora/milestones{/number}","notifications_url":"https://api.github.com/repos/softwerkskammer/Agora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/softwerkskammer/Agora/labels{/name}","releases_url":"https://api.github.com/repos/softwerkskammer/Agora/releases{/id}","deployments_url":"https://api.github.com/repos/softwerkskammer/Agora/deployments","created_at":"2013-03-14T21:07:21Z","updated_at":"2016-09-08T09:35:05Z","pushed_at":"2016-09-11T16:03:20Z","git_url":"git://github.com/softwerkskammer/Agora.git","ssh_url":"git@github.com:softwerkskammer/Agora.git","clone_url":"https://github.com/softwerkskammer/Agora.git","svn_url":"https://github.com/softwerkskammer/Agora","homepage":"","size":20160,"stargazers_count":36,"watchers_count":36,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":63,"mirror_url":null,"open_issues_count":5,"forks":63,"open_issues":5,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/softwerkskammer/Agora/pulls/1119"},"html":{"href":"https://github.com/softwerkskammer/Agora/pull/1119"},"issue":{"href":"https://api.github.com/repos/softwerkskammer/Agora/issues/1119"},"comments":{"href":"https://api.github.com/repos/softwerkskammer/Agora/issues/1119/comments"},"review_comments":{"href":"https://api.github.com/repos/softwerkskammer/Agora/pulls/1119/comments"},"review_comment":{"href":"https://api.github.com/repos/softwerkskammer/Agora/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/softwerkskammer/Agora/pulls/1119/commits"},"statuses":{"href":"https://api.github.com/repos/softwerkskammer/Agora/statuses/f165a1ff1c4d8df2d44d5b5990fb0558f0fb95ea"}}}}
{"actor":{"display_login":"leider"}}