{"action":"created","comment":{"url":"https://api.github.com/repos/ntindall/KVStore/pulls/comments/55125969","id":55125969,"diff_hunk":"@@ -187,37 +146,82 @@ sendResponse kvMsg@(KVRegistration txn_id hostName portId) = do\n     liftIO $ KVProtocol.sendMessage clientH $ KVAck (clientId, snd txn_id) $ Just clientId\n     liftIO $ hClose clientH\n \n-sendResponse (KVAck txn_id (Just slave_id)) = do\n+processMessage _ = undefined\n+\n+timeoutThread :: ReaderT (MVar MasterState) IO ()\n+timeoutThread = do\n   mvar <- ask\n-  liftIO $ do\n-    state <- takeMVar mvar\n \n-    let acks = if Map.member txn_id (ackMap state) then ackMap state else Map.insert txn_id Set.empty (ackMap state)\n-        slvIds = fromJust $ Map.lookup txn_id acks\n+--  liftIO $ traceIO \"Timing out! in timeout thread!\"\n \n-    if not (Set.member slave_id slvIds) && Set.size slvIds == Prelude.length (Lib.slaveConfig $ cfg state) - 1\n-    then do --the ACK we are processing is the last ack from the ring\n-      putMVar mvar $ state { ackMap = Map.delete txn_id acks, \n-                             voteMap = Map.delete txn_id $ voteMap state,\n-                             timeoutMap = Map.delete txn_id $ timeoutMap state\n-                           }\n-      liftIO $ sendMsgToClient (KVAck txn_id Nothing) (cfg state) -- todo: these should just not return anything\n+  state <- liftIO $ readMVar mvar\n+  now <- liftIO $ U.currentTimeInt\n \n-    else putMVar mvar $ state { ackMap = Map.insert txn_id (Set.insert slave_id slvIds) acks }\n+  let timeoutMap' = Map.toList $ timeoutMap state\n \n+  mapM_ (\\(txn_id,(ts,msg)) -> do","path":"master/Master.hs","position":192,"original_position":192,"commit_id":"3948eeb189a7e05bc5b71b59aadf3cf77d8023ff","original_commit_id":"3948eeb189a7e05bc5b71b59aadf3cf77d8023ff","user":{"login":"ntindall","id":6983492,"avatar_url":"https://avatars.githubusercontent.com/u/6983492?v=3","gravatar_id":"","url":"https://api.github.com/users/ntindall","html_url":"https://github.com/ntindall","followers_url":"https://api.github.com/users/ntindall/followers","following_url":"https://api.github.com/users/ntindall/following{/other_user}","gists_url":"https://api.github.com/users/ntindall/gists{/gist_id}","starred_url":"https://api.github.com/users/ntindall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntindall/subscriptions","organizations_url":"https://api.github.com/users/ntindall/orgs","repos_url":"https://api.github.com/users/ntindall/repos","events_url":"https://api.github.com/users/ntindall/events{/privacy}","received_events_url":"https://api.github.com/users/ntindall/received_events","type":"User","site_admin":false},"body":"is it possible to use the `timedOut` function here? ","created_at":"2016-03-05T18:56:38Z","updated_at":"2016-03-05T18:56:38Z","html_url":"https://github.com/ntindall/KVStore/pull/3#discussion_r55125969","pull_request_url":"https://api.github.com/repos/ntindall/KVStore/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/ntindall/KVStore/pulls/comments/55125969"},"html":{"href":"https://github.com/ntindall/KVStore/pull/3#discussion_r55125969"},"pull_request":{"href":"https://api.github.com/repos/ntindall/KVStore/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/ntindall/KVStore/pulls/3","id":61796294,"html_url":"https://github.com/ntindall/KVStore/pull/3","diff_url":"https://github.com/ntindall/KVStore/pull/3.diff","patch_url":"https://github.com/ntindall/KVStore/pull/3.patch","issue_url":"https://api.github.com/repos/ntindall/KVStore/issues/3","number":3,"state":"open","locked":false,"title":"Colin","user":{"login":"colinman","id":6269426,"avatar_url":"https://avatars.githubusercontent.com/u/6269426?v=3","gravatar_id":"","url":"https://api.github.com/users/colinman","html_url":"https://github.com/colinman","followers_url":"https://api.github.com/users/colinman/followers","following_url":"https://api.github.com/users/colinman/following{/other_user}","gists_url":"https://api.github.com/users/colinman/gists{/gist_id}","starred_url":"https://api.github.com/users/colinman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinman/subscriptions","organizations_url":"https://api.github.com/users/colinman/orgs","repos_url":"https://api.github.com/users/colinman/repos","events_url":"https://api.github.com/users/colinman/events{/privacy}","received_events_url":"https://api.github.com/users/colinman/received_events","type":"User","site_admin":false},"body":"Some refactors to master that will make everything cleaner. We still need to add separate maps for put and get requests. We can consolidate some of the helper methods once we've established the different maps that we're going to have.","created_at":"2016-03-05T01:56:09Z","updated_at":"2016-03-05T18:56:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ntindall/KVStore/pulls/3/commits","review_comments_url":"https://api.github.com/repos/ntindall/KVStore/pulls/3/comments","review_comment_url":"https://api.github.com/repos/ntindall/KVStore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ntindall/KVStore/issues/3/comments","statuses_url":"https://api.github.com/repos/ntindall/KVStore/statuses/3948eeb189a7e05bc5b71b59aadf3cf77d8023ff","head":{"label":"ntindall:colin","ref":"colin","sha":"3948eeb189a7e05bc5b71b59aadf3cf77d8023ff","user":{"login":"ntindall","id":6983492,"avatar_url":"https://avatars.githubusercontent.com/u/6983492?v=3","gravatar_id":"","url":"https://api.github.com/users/ntindall","html_url":"https://github.com/ntindall","followers_url":"https://api.github.com/users/ntindall/followers","following_url":"https://api.github.com/users/ntindall/following{/other_user}","gists_url":"https://api.github.com/users/ntindall/gists{/gist_id}","starred_url":"https://api.github.com/users/ntindall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntindall/subscriptions","organizations_url":"https://api.github.com/users/ntindall/orgs","repos_url":"https://api.github.com/users/ntindall/repos","events_url":"https://api.github.com/users/ntindall/events{/privacy}","received_events_url":"https://api.github.com/users/ntindall/received_events","type":"User","site_admin":false},"repo":{"id":51407899,"name":"KVStore","full_name":"ntindall/KVStore","owner":{"login":"ntindall","id":6983492,"avatar_url":"https://avatars.githubusercontent.com/u/6983492?v=3","gravatar_id":"","url":"https://api.github.com/users/ntindall","html_url":"https://github.com/ntindall","followers_url":"https://api.github.com/users/ntindall/followers","following_url":"https://api.github.com/users/ntindall/following{/other_user}","gists_url":"https://api.github.com/users/ntindall/gists{/gist_id}","starred_url":"https://api.github.com/users/ntindall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntindall/subscriptions","organizations_url":"https://api.github.com/users/ntindall/orgs","repos_url":"https://api.github.com/users/ntindall/repos","events_url":"https://api.github.com/users/ntindall/events{/privacy}","received_events_url":"https://api.github.com/users/ntindall/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ntindall/KVStore","description":"","fork":false,"url":"https://api.github.com/repos/ntindall/KVStore","forks_url":"https://api.github.com/repos/ntindall/KVStore/forks","keys_url":"https://api.github.com/repos/ntindall/KVStore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ntindall/KVStore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ntindall/KVStore/teams","hooks_url":"https://api.github.com/repos/ntindall/KVStore/hooks","issue_events_url":"https://api.github.com/repos/ntindall/KVStore/issues/events{/number}","events_url":"https://api.github.com/repos/ntindall/KVStore/events","assignees_url":"https://api.github.com/repos/ntindall/KVStore/assignees{/user}","branches_url":"https://api.github.com/repos/ntindall/KVStore/branches{/branch}","tags_url":"https://api.github.com/repos/ntindall/KVStore/tags","blobs_url":"https://api.github.com/repos/ntindall/KVStore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ntindall/KVStore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ntindall/KVStore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ntindall/KVStore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ntindall/KVStore/statuses/{sha}","languages_url":"https://api.github.com/repos/ntindall/KVStore/languages","stargazers_url":"https://api.github.com/repos/ntindall/KVStore/stargazers","contributors_url":"https://api.github.com/repos/ntindall/KVStore/contributors","subscribers_url":"https://api.github.com/repos/ntindall/KVStore/subscribers","subscription_url":"https://api.github.com/repos/ntindall/KVStore/subscription","commits_url":"https://api.github.com/repos/ntindall/KVStore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ntindall/KVStore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ntindall/KVStore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ntindall/KVStore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ntindall/KVStore/contents/{+path}","compare_url":"https://api.github.com/repos/ntindall/KVStore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ntindall/KVStore/merges","archive_url":"https://api.github.com/repos/ntindall/KVStore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ntindall/KVStore/downloads","issues_url":"https://api.github.com/repos/ntindall/KVStore/issues{/number}","pulls_url":"https://api.github.com/repos/ntindall/KVStore/pulls{/number}","milestones_url":"https://api.github.com/repos/ntindall/KVStore/milestones{/number}","notifications_url":"https://api.github.com/repos/ntindall/KVStore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ntindall/KVStore/labels{/name}","releases_url":"https://api.github.com/repos/ntindall/KVStore/releases{/id}","deployments_url":"https://api.github.com/repos/ntindall/KVStore/deployments","created_at":"2016-02-09T23:15:33Z","updated_at":"2016-02-09T23:15:49Z","pushed_at":"2016-03-05T01:56:09Z","git_url":"git://github.com/ntindall/KVStore.git","ssh_url":"git@github.com:ntindall/KVStore.git","clone_url":"https://github.com/ntindall/KVStore.git","svn_url":"https://github.com/ntindall/KVStore","homepage":null,"size":109,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"ntindall:master","ref":"master","sha":"78badbf13cc401164f7153c56155d398ab793a1e","user":{"login":"ntindall","id":6983492,"avatar_url":"https://avatars.githubusercontent.com/u/6983492?v=3","gravatar_id":"","url":"https://api.github.com/users/ntindall","html_url":"https://github.com/ntindall","followers_url":"https://api.github.com/users/ntindall/followers","following_url":"https://api.github.com/users/ntindall/following{/other_user}","gists_url":"https://api.github.com/users/ntindall/gists{/gist_id}","starred_url":"https://api.github.com/users/ntindall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntindall/subscriptions","organizations_url":"https://api.github.com/users/ntindall/orgs","repos_url":"https://api.github.com/users/ntindall/repos","events_url":"https://api.github.com/users/ntindall/events{/privacy}","received_events_url":"https://api.github.com/users/ntindall/received_events","type":"User","site_admin":false},"repo":{"id":51407899,"name":"KVStore","full_name":"ntindall/KVStore","owner":{"login":"ntindall","id":6983492,"avatar_url":"https://avatars.githubusercontent.com/u/6983492?v=3","gravatar_id":"","url":"https://api.github.com/users/ntindall","html_url":"https://github.com/ntindall","followers_url":"https://api.github.com/users/ntindall/followers","following_url":"https://api.github.com/users/ntindall/following{/other_user}","gists_url":"https://api.github.com/users/ntindall/gists{/gist_id}","starred_url":"https://api.github.com/users/ntindall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntindall/subscriptions","organizations_url":"https://api.github.com/users/ntindall/orgs","repos_url":"https://api.github.com/users/ntindall/repos","events_url":"https://api.github.com/users/ntindall/events{/privacy}","received_events_url":"https://api.github.com/users/ntindall/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ntindall/KVStore","description":"","fork":false,"url":"https://api.github.com/repos/ntindall/KVStore","forks_url":"https://api.github.com/repos/ntindall/KVStore/forks","keys_url":"https://api.github.com/repos/ntindall/KVStore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ntindall/KVStore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ntindall/KVStore/teams","hooks_url":"https://api.github.com/repos/ntindall/KVStore/hooks","issue_events_url":"https://api.github.com/repos/ntindall/KVStore/issues/events{/number}","events_url":"https://api.github.com/repos/ntindall/KVStore/events","assignees_url":"https://api.github.com/repos/ntindall/KVStore/assignees{/user}","branches_url":"https://api.github.com/repos/ntindall/KVStore/branches{/branch}","tags_url":"https://api.github.com/repos/ntindall/KVStore/tags","blobs_url":"https://api.github.com/repos/ntindall/KVStore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ntindall/KVStore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ntindall/KVStore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ntindall/KVStore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ntindall/KVStore/statuses/{sha}","languages_url":"https://api.github.com/repos/ntindall/KVStore/languages","stargazers_url":"https://api.github.com/repos/ntindall/KVStore/stargazers","contributors_url":"https://api.github.com/repos/ntindall/KVStore/contributors","subscribers_url":"https://api.github.com/repos/ntindall/KVStore/subscribers","subscription_url":"https://api.github.com/repos/ntindall/KVStore/subscription","commits_url":"https://api.github.com/repos/ntindall/KVStore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ntindall/KVStore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ntindall/KVStore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ntindall/KVStore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ntindall/KVStore/contents/{+path}","compare_url":"https://api.github.com/repos/ntindall/KVStore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ntindall/KVStore/merges","archive_url":"https://api.github.com/repos/ntindall/KVStore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ntindall/KVStore/downloads","issues_url":"https://api.github.com/repos/ntindall/KVStore/issues{/number}","pulls_url":"https://api.github.com/repos/ntindall/KVStore/pulls{/number}","milestones_url":"https://api.github.com/repos/ntindall/KVStore/milestones{/number}","notifications_url":"https://api.github.com/repos/ntindall/KVStore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ntindall/KVStore/labels{/name}","releases_url":"https://api.github.com/repos/ntindall/KVStore/releases{/id}","deployments_url":"https://api.github.com/repos/ntindall/KVStore/deployments","created_at":"2016-02-09T23:15:33Z","updated_at":"2016-02-09T23:15:49Z","pushed_at":"2016-03-05T01:56:09Z","git_url":"git://github.com/ntindall/KVStore.git","ssh_url":"git@github.com:ntindall/KVStore.git","clone_url":"https://github.com/ntindall/KVStore.git","svn_url":"https://github.com/ntindall/KVStore","homepage":null,"size":109,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ntindall/KVStore/pulls/3"},"html":{"href":"https://github.com/ntindall/KVStore/pull/3"},"issue":{"href":"https://api.github.com/repos/ntindall/KVStore/issues/3"},"comments":{"href":"https://api.github.com/repos/ntindall/KVStore/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/ntindall/KVStore/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/ntindall/KVStore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ntindall/KVStore/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/ntindall/KVStore/statuses/3948eeb189a7e05bc5b71b59aadf3cf77d8023ff"}}}}