{"action":"created","comment":{"url":"https://api.github.com/repos/praekelt/vumi/pulls/comments/39735858","id":39735858,"diff_hunk":"@@ -178,6 +198,20 @@ def get_cached_message(self, message_id):\n     def delete_cached_message(self, message_id):\n         return self.redis.delete(message_key(message_id))\n \n+    def cache_pdu(self, vumi_message_id, seq_no, pdu):\n+        # We the PDU in wire format to avoid json encoding troubles.\n+        key = pdu_key(seq_no)\n+        expiry = self.config.submit_sm_expiry\n+        return self.redis.setex(key, expiry, json.dumps(\n+            {'vumi_message_id': vumi_message_id, 'pdu': pdu.get_hex()}))","path":"vumi/transports/smpp/smpp_transport.py","position":87,"original_position":87,"commit_id":"48498dc54397e3a04e4e66653bd1c50b09b514aa","original_commit_id":"48498dc54397e3a04e4e66653bd1c50b09b514aa","user":{"login":"hodgestar","id":165551,"avatar_url":"https://avatars.githubusercontent.com/u/165551?v=3","gravatar_id":"","url":"https://api.github.com/users/hodgestar","html_url":"https://github.com/hodgestar","followers_url":"https://api.github.com/users/hodgestar/followers","following_url":"https://api.github.com/users/hodgestar/following{/other_user}","gists_url":"https://api.github.com/users/hodgestar/gists{/gist_id}","starred_url":"https://api.github.com/users/hodgestar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hodgestar/subscriptions","organizations_url":"https://api.github.com/users/hodgestar/orgs","repos_url":"https://api.github.com/users/hodgestar/repos","events_url":"https://api.github.com/users/hodgestar/events{/privacy}","received_events_url":"https://api.github.com/users/hodgestar/received_events","type":"User","site_admin":false},"body":"Should we move this `json.dumps(...)` into a `.to_json(..)` method on `CachedPDU`?","created_at":"2015-09-17T11:36:51Z","updated_at":"2015-09-17T11:36:51Z","html_url":"https://github.com/praekelt/vumi/pull/965#discussion_r39735858","pull_request_url":"https://api.github.com/repos/praekelt/vumi/pulls/965","_links":{"self":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/comments/39735858"},"html":{"href":"https://github.com/praekelt/vumi/pull/965#discussion_r39735858"},"pull_request":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/965"}}},"pull_request":{"url":"https://api.github.com/repos/praekelt/vumi/pulls/965","id":45067918,"html_url":"https://github.com/praekelt/vumi/pull/965","diff_url":"https://github.com/praekelt/vumi/pull/965.diff","patch_url":"https://github.com/praekelt/vumi/pull/965.patch","issue_url":"https://api.github.com/repos/praekelt/vumi/issues/965","number":965,"state":"open","locked":false,"title":"SMPP transport handles throttling by message instead of PDU","user":{"login":"jerith","id":43731,"avatar_url":"https://avatars.githubusercontent.com/u/43731?v=3","gravatar_id":"","url":"https://api.github.com/users/jerith","html_url":"https://github.com/jerith","followers_url":"https://api.github.com/users/jerith/followers","following_url":"https://api.github.com/users/jerith/following{/other_user}","gists_url":"https://api.github.com/users/jerith/gists{/gist_id}","starred_url":"https://api.github.com/users/jerith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerith/subscriptions","organizations_url":"https://api.github.com/users/jerith/orgs","repos_url":"https://api.github.com/users/jerith/repos","events_url":"https://api.github.com/users/jerith/events{/privacy}","received_events_url":"https://api.github.com/users/jerith/received_events","type":"User","site_admin":false},"body":"This is a problem when we have multiple PDUs per message.","created_at":"2015-09-15T15:58:49Z","updated_at":"2015-09-17T11:36:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5314898f8462d7057245a79062cf61ea9c7ede2e","assignee":{"login":"jerith","id":43731,"avatar_url":"https://avatars.githubusercontent.com/u/43731?v=3","gravatar_id":"","url":"https://api.github.com/users/jerith","html_url":"https://github.com/jerith","followers_url":"https://api.github.com/users/jerith/followers","following_url":"https://api.github.com/users/jerith/following{/other_user}","gists_url":"https://api.github.com/users/jerith/gists{/gist_id}","starred_url":"https://api.github.com/users/jerith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerith/subscriptions","organizations_url":"https://api.github.com/users/jerith/orgs","repos_url":"https://api.github.com/users/jerith/repos","events_url":"https://api.github.com/users/jerith/events{/privacy}","received_events_url":"https://api.github.com/users/jerith/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/praekelt/vumi/pulls/965/commits","review_comments_url":"https://api.github.com/repos/praekelt/vumi/pulls/965/comments","review_comment_url":"https://api.github.com/repos/praekelt/vumi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/praekelt/vumi/issues/965/comments","statuses_url":"https://api.github.com/repos/praekelt/vumi/statuses/48498dc54397e3a04e4e66653bd1c50b09b514aa","head":{"label":"praekelt:feature/issue-965-smpp-throttle-by-pdu","ref":"feature/issue-965-smpp-throttle-by-pdu","sha":"48498dc54397e3a04e4e66653bd1c50b09b514aa","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":1081665,"name":"vumi","full_name":"praekelt/vumi","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/vumi","description":"Messaging engine for the delivery of SMS, Star Menu and chat messages to diverse audiences in emerging markets and beyond.","fork":false,"url":"https://api.github.com/repos/praekelt/vumi","forks_url":"https://api.github.com/repos/praekelt/vumi/forks","keys_url":"https://api.github.com/repos/praekelt/vumi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/vumi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/vumi/teams","hooks_url":"https://api.github.com/repos/praekelt/vumi/hooks","issue_events_url":"https://api.github.com/repos/praekelt/vumi/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/vumi/events","assignees_url":"https://api.github.com/repos/praekelt/vumi/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/vumi/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/vumi/tags","blobs_url":"https://api.github.com/repos/praekelt/vumi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/vumi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/vumi/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/vumi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/vumi/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/vumi/languages","stargazers_url":"https://api.github.com/repos/praekelt/vumi/stargazers","contributors_url":"https://api.github.com/repos/praekelt/vumi/contributors","subscribers_url":"https://api.github.com/repos/praekelt/vumi/subscribers","subscription_url":"https://api.github.com/repos/praekelt/vumi/subscription","commits_url":"https://api.github.com/repos/praekelt/vumi/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/vumi/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/vumi/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/vumi/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/vumi/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/vumi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/vumi/merges","archive_url":"https://api.github.com/repos/praekelt/vumi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/vumi/downloads","issues_url":"https://api.github.com/repos/praekelt/vumi/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/vumi/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/vumi/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/vumi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/vumi/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/vumi/releases{/id}","created_at":"2010-11-15T11:34:03Z","updated_at":"2015-09-16T06:42:17Z","pushed_at":"2015-09-16T06:49:45Z","git_url":"git://github.com/praekelt/vumi.git","ssh_url":"git@github.com:praekelt/vumi.git","clone_url":"https://github.com/praekelt/vumi.git","svn_url":"https://github.com/praekelt/vumi","homepage":"","size":22128,"stargazers_count":230,"watchers_count":230,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":92,"forks":84,"open_issues":92,"watchers":230,"default_branch":"develop"}},"base":{"label":"praekelt:develop","ref":"develop","sha":"1f2da55317fa9937764abca3683a69ea5779f51c","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":1081665,"name":"vumi","full_name":"praekelt/vumi","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/vumi","description":"Messaging engine for the delivery of SMS, Star Menu and chat messages to diverse audiences in emerging markets and beyond.","fork":false,"url":"https://api.github.com/repos/praekelt/vumi","forks_url":"https://api.github.com/repos/praekelt/vumi/forks","keys_url":"https://api.github.com/repos/praekelt/vumi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/vumi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/vumi/teams","hooks_url":"https://api.github.com/repos/praekelt/vumi/hooks","issue_events_url":"https://api.github.com/repos/praekelt/vumi/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/vumi/events","assignees_url":"https://api.github.com/repos/praekelt/vumi/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/vumi/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/vumi/tags","blobs_url":"https://api.github.com/repos/praekelt/vumi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/vumi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/vumi/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/vumi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/vumi/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/vumi/languages","stargazers_url":"https://api.github.com/repos/praekelt/vumi/stargazers","contributors_url":"https://api.github.com/repos/praekelt/vumi/contributors","subscribers_url":"https://api.github.com/repos/praekelt/vumi/subscribers","subscription_url":"https://api.github.com/repos/praekelt/vumi/subscription","commits_url":"https://api.github.com/repos/praekelt/vumi/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/vumi/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/vumi/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/vumi/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/vumi/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/vumi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/vumi/merges","archive_url":"https://api.github.com/repos/praekelt/vumi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/vumi/downloads","issues_url":"https://api.github.com/repos/praekelt/vumi/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/vumi/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/vumi/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/vumi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/vumi/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/vumi/releases{/id}","created_at":"2010-11-15T11:34:03Z","updated_at":"2015-09-16T06:42:17Z","pushed_at":"2015-09-16T06:49:45Z","git_url":"git://github.com/praekelt/vumi.git","ssh_url":"git@github.com:praekelt/vumi.git","clone_url":"https://github.com/praekelt/vumi.git","svn_url":"https://github.com/praekelt/vumi","homepage":"","size":22128,"stargazers_count":230,"watchers_count":230,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":92,"forks":84,"open_issues":92,"watchers":230,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/965"},"html":{"href":"https://github.com/praekelt/vumi/pull/965"},"issue":{"href":"https://api.github.com/repos/praekelt/vumi/issues/965"},"comments":{"href":"https://api.github.com/repos/praekelt/vumi/issues/965/comments"},"review_comments":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/965/comments"},"review_comment":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/965/commits"},"statuses":{"href":"https://api.github.com/repos/praekelt/vumi/statuses/48498dc54397e3a04e4e66653bd1c50b09b514aa"}}}}