{"action":"created","comment":{"url":"https://api.github.com/repos/ncalexan/datomish/pulls/comments/81833703","pull_request_review_id":2783096,"id":81833703,"diff_hunk":"@@ -101,7 +103,13 @@\n ;; TODO: implement support for DB parts?\n \n (defn connection-with-db [db]\n-  (map->Connection {:current-db (atom db)}))\n+  (let [listener-source (a/chan (a/sliding-buffer 1))]","path":"src/common/datomish/transact.cljc","position":43,"original_position":34,"commit_id":"376c4914b11b118dbe1d9ca39c7f133defd74363","original_commit_id":"376c4914b11b118dbe1d9ca39c7f133defd74363","user":{"login":"rnewman","id":91722,"avatar_url":"https://avatars.githubusercontent.com/u/91722?v=3","gravatar_id":"","url":"https://api.github.com/users/rnewman","html_url":"https://github.com/rnewman","followers_url":"https://api.github.com/users/rnewman/followers","following_url":"https://api.github.com/users/rnewman/following{/other_user}","gists_url":"https://api.github.com/users/rnewman/gists{/gist_id}","starred_url":"https://api.github.com/users/rnewman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rnewman/subscriptions","organizations_url":"https://api.github.com/users/rnewman/orgs","repos_url":"https://api.github.com/users/rnewman/repos","events_url":"https://api.github.com/users/rnewman/events{/privacy}","received_events_url":"https://api.github.com/users/rnewman/received_events","type":"User","site_admin":false},"body":"Obviously this can't simply be a blocking buffer, because in the no-listener case we don't want to block.\r\n\r\nBut there are two downsides to the way this is implemented:\r\n\r\n- When there are no listeners, the `mult` will never be consumed by a tap, and so we'll always hang on to the last `txReport` in `listener-source`. Furthermore, a new subscriber will thus always get the last `txReport` delivered to it!\r\n- When there are listeners, if this buffer is ever full (perhaps because we're waiting for a tap to finish running before we can consume from the source), then a second completed transact will lose whatever's waiting in the buffer, even if there are consumers waiting for it. Expecting otherwise is, I think, an assumption about how `mult`/`tap` work, no?\r\n\r\nTo solve the former, I think we need a no-op tap: it simply serves the purpose of always consuming the `mult`. All subsequent taps will start with an empty buffer.\r\n\r\nAnd if we have that, I think we can solve the other scenario by making this blocking (and optionally making the buffer bigger). Writes will block until they're able to push into this channel, which should only be long enough to enqueue the last write on each listener's channel (which, because _those_ are all non-blocking, shouldn't be long).\r\n\r\nAm I talking nonsense, or do you agree?","created_at":"2016-10-04T19:25:13Z","updated_at":"2016-10-04T19:33:39Z","html_url":"https://github.com/ncalexan/datomish/pull/14#discussion_r81833703","pull_request_url":"https://api.github.com/repos/ncalexan/datomish/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/ncalexan/datomish/pulls/comments/81833703"},"html":{"href":"https://github.com/ncalexan/datomish/pull/14#discussion_r81833703"},"pull_request":{"href":"https://api.github.com/repos/ncalexan/datomish/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/ncalexan/datomish/pulls/14","id":87245564,"html_url":"https://github.com/ncalexan/datomish/pull/14","diff_url":"https://github.com/ncalexan/datomish/pull/14.diff","patch_url":"https://github.com/ncalexan/datomish/pull/14.patch","issue_url":"https://api.github.com/repos/ncalexan/datomish/issues/14","number":14,"state":"open","locked":false,"title":"Add {un}listen! to connection. Fixes #61.","user":{"login":"ncalexan","id":1097182,"avatar_url":"https://avatars.githubusercontent.com/u/1097182?v=3","gravatar_id":"","url":"https://api.github.com/users/ncalexan","html_url":"https://github.com/ncalexan","followers_url":"https://api.github.com/users/ncalexan/followers","following_url":"https://api.github.com/users/ncalexan/following{/other_user}","gists_url":"https://api.github.com/users/ncalexan/gists{/gist_id}","starred_url":"https://api.github.com/users/ncalexan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncalexan/subscriptions","organizations_url":"https://api.github.com/users/ncalexan/orgs","repos_url":"https://api.github.com/users/ncalexan/repos","events_url":"https://api.github.com/users/ncalexan/events{/privacy}","received_events_url":"https://api.github.com/users/ncalexan/received_events","type":"User","site_admin":false},"body":"Just the top commit, @rnewman.","created_at":"2016-09-29T04:42:58Z","updated_at":"2016-10-04T19:33:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c5b53ec9bf7cfb3a83a46acc1dc91fcfd4047cf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ncalexan/datomish/pulls/14/commits","review_comments_url":"https://api.github.com/repos/ncalexan/datomish/pulls/14/comments","review_comment_url":"https://api.github.com/repos/ncalexan/datomish/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ncalexan/datomish/issues/14/comments","statuses_url":"https://api.github.com/repos/ncalexan/datomish/statuses/376c4914b11b118dbe1d9ca39c7f133defd74363","head":{"label":"ncalexan:listen","ref":"listen","sha":"376c4914b11b118dbe1d9ca39c7f133defd74363","user":{"login":"ncalexan","id":1097182,"avatar_url":"https://avatars.githubusercontent.com/u/1097182?v=3","gravatar_id":"","url":"https://api.github.com/users/ncalexan","html_url":"https://github.com/ncalexan","followers_url":"https://api.github.com/users/ncalexan/followers","following_url":"https://api.github.com/users/ncalexan/following{/other_user}","gists_url":"https://api.github.com/users/ncalexan/gists{/gist_id}","starred_url":"https://api.github.com/users/ncalexan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncalexan/subscriptions","organizations_url":"https://api.github.com/users/ncalexan/orgs","repos_url":"https://api.github.com/users/ncalexan/repos","events_url":"https://api.github.com/users/ncalexan/events{/privacy}","received_events_url":"https://api.github.com/users/ncalexan/received_events","type":"User","site_admin":false},"repo":{"id":62674602,"name":"datomish","full_name":"ncalexan/datomish","owner":{"login":"ncalexan","id":1097182,"avatar_url":"https://avatars.githubusercontent.com/u/1097182?v=3","gravatar_id":"","url":"https://api.github.com/users/ncalexan","html_url":"https://github.com/ncalexan","followers_url":"https://api.github.com/users/ncalexan/followers","following_url":"https://api.github.com/users/ncalexan/following{/other_user}","gists_url":"https://api.github.com/users/ncalexan/gists{/gist_id}","starred_url":"https://api.github.com/users/ncalexan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncalexan/subscriptions","organizations_url":"https://api.github.com/users/ncalexan/orgs","repos_url":"https://api.github.com/users/ncalexan/repos","events_url":"https://api.github.com/users/ncalexan/events{/privacy}","received_events_url":"https://api.github.com/users/ncalexan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ncalexan/datomish","description":"A persistent, relational store inspired by Datomic and DataScript.","fork":false,"url":"https://api.github.com/repos/ncalexan/datomish","forks_url":"https://api.github.com/repos/ncalexan/datomish/forks","keys_url":"https://api.github.com/repos/ncalexan/datomish/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ncalexan/datomish/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ncalexan/datomish/teams","hooks_url":"https://api.github.com/repos/ncalexan/datomish/hooks","issue_events_url":"https://api.github.com/repos/ncalexan/datomish/issues/events{/number}","events_url":"https://api.github.com/repos/ncalexan/datomish/events","assignees_url":"https://api.github.com/repos/ncalexan/datomish/assignees{/user}","branches_url":"https://api.github.com/repos/ncalexan/datomish/branches{/branch}","tags_url":"https://api.github.com/repos/ncalexan/datomish/tags","blobs_url":"https://api.github.com/repos/ncalexan/datomish/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ncalexan/datomish/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ncalexan/datomish/git/refs{/sha}","trees_url":"https://api.github.com/repos/ncalexan/datomish/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ncalexan/datomish/statuses/{sha}","languages_url":"https://api.github.com/repos/ncalexan/datomish/languages","stargazers_url":"https://api.github.com/repos/ncalexan/datomish/stargazers","contributors_url":"https://api.github.com/repos/ncalexan/datomish/contributors","subscribers_url":"https://api.github.com/repos/ncalexan/datomish/subscribers","subscription_url":"https://api.github.com/repos/ncalexan/datomish/subscription","commits_url":"https://api.github.com/repos/ncalexan/datomish/commits{/sha}","git_commits_url":"https://api.github.com/repos/ncalexan/datomish/git/commits{/sha}","comments_url":"https://api.github.com/repos/ncalexan/datomish/comments{/number}","issue_comment_url":"https://api.github.com/repos/ncalexan/datomish/issues/comments{/number}","contents_url":"https://api.github.com/repos/ncalexan/datomish/contents/{+path}","compare_url":"https://api.github.com/repos/ncalexan/datomish/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ncalexan/datomish/merges","archive_url":"https://api.github.com/repos/ncalexan/datomish/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ncalexan/datomish/downloads","issues_url":"https://api.github.com/repos/ncalexan/datomish/issues{/number}","pulls_url":"https://api.github.com/repos/ncalexan/datomish/pulls{/number}","milestones_url":"https://api.github.com/repos/ncalexan/datomish/milestones{/number}","notifications_url":"https://api.github.com/repos/ncalexan/datomish/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ncalexan/datomish/labels{/name}","releases_url":"https://api.github.com/repos/ncalexan/datomish/releases{/id}","deployments_url":"https://api.github.com/repos/ncalexan/datomish/deployments","created_at":"2016-07-05T22:48:01Z","updated_at":"2016-09-18T16:25:39Z","pushed_at":"2016-10-03T21:59:02Z","git_url":"git://github.com/ncalexan/datomish.git","ssh_url":"git@github.com:ncalexan/datomish.git","clone_url":"https://github.com/ncalexan/datomish.git","svn_url":"https://github.com/ncalexan/datomish","homepage":null,"size":420,"stargazers_count":3,"watchers_count":3,"language":"Clojure","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"ncalexan:master","ref":"master","sha":"2e9a0f089c5039fc61cf4455bc2ad9c5d5bafa35","user":{"login":"ncalexan","id":1097182,"avatar_url":"https://avatars.githubusercontent.com/u/1097182?v=3","gravatar_id":"","url":"https://api.github.com/users/ncalexan","html_url":"https://github.com/ncalexan","followers_url":"https://api.github.com/users/ncalexan/followers","following_url":"https://api.github.com/users/ncalexan/following{/other_user}","gists_url":"https://api.github.com/users/ncalexan/gists{/gist_id}","starred_url":"https://api.github.com/users/ncalexan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncalexan/subscriptions","organizations_url":"https://api.github.com/users/ncalexan/orgs","repos_url":"https://api.github.com/users/ncalexan/repos","events_url":"https://api.github.com/users/ncalexan/events{/privacy}","received_events_url":"https://api.github.com/users/ncalexan/received_events","type":"User","site_admin":false},"repo":{"id":62674602,"name":"datomish","full_name":"ncalexan/datomish","owner":{"login":"ncalexan","id":1097182,"avatar_url":"https://avatars.githubusercontent.com/u/1097182?v=3","gravatar_id":"","url":"https://api.github.com/users/ncalexan","html_url":"https://github.com/ncalexan","followers_url":"https://api.github.com/users/ncalexan/followers","following_url":"https://api.github.com/users/ncalexan/following{/other_user}","gists_url":"https://api.github.com/users/ncalexan/gists{/gist_id}","starred_url":"https://api.github.com/users/ncalexan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncalexan/subscriptions","organizations_url":"https://api.github.com/users/ncalexan/orgs","repos_url":"https://api.github.com/users/ncalexan/repos","events_url":"https://api.github.com/users/ncalexan/events{/privacy}","received_events_url":"https://api.github.com/users/ncalexan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ncalexan/datomish","description":"A persistent, relational store inspired by Datomic and DataScript.","fork":false,"url":"https://api.github.com/repos/ncalexan/datomish","forks_url":"https://api.github.com/repos/ncalexan/datomish/forks","keys_url":"https://api.github.com/repos/ncalexan/datomish/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ncalexan/datomish/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ncalexan/datomish/teams","hooks_url":"https://api.github.com/repos/ncalexan/datomish/hooks","issue_events_url":"https://api.github.com/repos/ncalexan/datomish/issues/events{/number}","events_url":"https://api.github.com/repos/ncalexan/datomish/events","assignees_url":"https://api.github.com/repos/ncalexan/datomish/assignees{/user}","branches_url":"https://api.github.com/repos/ncalexan/datomish/branches{/branch}","tags_url":"https://api.github.com/repos/ncalexan/datomish/tags","blobs_url":"https://api.github.com/repos/ncalexan/datomish/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ncalexan/datomish/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ncalexan/datomish/git/refs{/sha}","trees_url":"https://api.github.com/repos/ncalexan/datomish/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ncalexan/datomish/statuses/{sha}","languages_url":"https://api.github.com/repos/ncalexan/datomish/languages","stargazers_url":"https://api.github.com/repos/ncalexan/datomish/stargazers","contributors_url":"https://api.github.com/repos/ncalexan/datomish/contributors","subscribers_url":"https://api.github.com/repos/ncalexan/datomish/subscribers","subscription_url":"https://api.github.com/repos/ncalexan/datomish/subscription","commits_url":"https://api.github.com/repos/ncalexan/datomish/commits{/sha}","git_commits_url":"https://api.github.com/repos/ncalexan/datomish/git/commits{/sha}","comments_url":"https://api.github.com/repos/ncalexan/datomish/comments{/number}","issue_comment_url":"https://api.github.com/repos/ncalexan/datomish/issues/comments{/number}","contents_url":"https://api.github.com/repos/ncalexan/datomish/contents/{+path}","compare_url":"https://api.github.com/repos/ncalexan/datomish/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ncalexan/datomish/merges","archive_url":"https://api.github.com/repos/ncalexan/datomish/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ncalexan/datomish/downloads","issues_url":"https://api.github.com/repos/ncalexan/datomish/issues{/number}","pulls_url":"https://api.github.com/repos/ncalexan/datomish/pulls{/number}","milestones_url":"https://api.github.com/repos/ncalexan/datomish/milestones{/number}","notifications_url":"https://api.github.com/repos/ncalexan/datomish/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ncalexan/datomish/labels{/name}","releases_url":"https://api.github.com/repos/ncalexan/datomish/releases{/id}","deployments_url":"https://api.github.com/repos/ncalexan/datomish/deployments","created_at":"2016-07-05T22:48:01Z","updated_at":"2016-09-18T16:25:39Z","pushed_at":"2016-10-03T21:59:02Z","git_url":"git://github.com/ncalexan/datomish.git","ssh_url":"git@github.com:ncalexan/datomish.git","clone_url":"https://github.com/ncalexan/datomish.git","svn_url":"https://github.com/ncalexan/datomish","homepage":null,"size":420,"stargazers_count":3,"watchers_count":3,"language":"Clojure","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ncalexan/datomish/pulls/14"},"html":{"href":"https://github.com/ncalexan/datomish/pull/14"},"issue":{"href":"https://api.github.com/repos/ncalexan/datomish/issues/14"},"comments":{"href":"https://api.github.com/repos/ncalexan/datomish/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/ncalexan/datomish/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/ncalexan/datomish/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ncalexan/datomish/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/ncalexan/datomish/statuses/376c4914b11b118dbe1d9ca39c7f133defd74363"}}}}
{"actor":{"display_login":"rnewman"}}