{"action":"created","comment":{"url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/comments/149803972","pull_request_review_id":75257550,"id":149803972,"diff_hunk":"@@ -64,32 +64,36 @@ def update_gym_info(self, gym_id, name, desc, url):\n             self._gym_info[gym_id] = {\"name\": name, \"description\": desc, \"url\": url}\n \n     def get_egg_expiration(self, gym_id):\n-        \"\"\" Updates the datetime that the egg expires. \"\"\"\n+        \"\"\" Returns the datetime that the egg expires. \"\"\"\n         return self._egg_hist.get(gym_id)\n \n     def update_egg_expiration(self, gym_id, expiration):\n         \"\"\" Updates the datetime that the egg expires. \"\"\"\n         self._egg_hist[gym_id] = expiration\n \n     def get_raid_expiration(self, gym_id):\n-        \"\"\" Updates the datetime that the raid_ expires. \"\"\"\n-        self._raid_hist.get(gym_id)\n+        \"\"\" Returns the datetime that the raid expires. \"\"\"\n+        return self._raid_hist.get(gym_id)\n \n     def update_raid_expiration(self, gym_id, expiration):\n-        \"\"\" Updates the datetime that the egg expires. \"\"\"\n+        \"\"\" Updates the datetime that the raid expires. \"\"\"\n         self._raid_hist[gym_id] = expiration\n \n-    def save(self):\n-        \"\"\" Export the data to a more permanent location. \"\"\"\n+    def cleanup_and_persist(self):\n+        \"\"\" Invalidates the cache and possibly persists its content. \"\"\"\n         self._clean_hist()\n-        log.debug(\"Cache cleaned!\")\n+        self._save()\n+\n+    def _save(self):\n+        \"\"\" Export the data to a more permanent location. \"\"\"\n+        # Mem cache won't be persisted.\n+        pass\n \n     def _clean_hist(self):\n         \"\"\" Clean expired objects to free up memory \"\"\"\n         for dict_ in (self._pokemon_hist, self._pokestop_hist, self._egg_hist, self._raid_hist):\n-            old = []\n-            for id_ in dict_:  # Gather old events\n-                if dict_[id_] < datetime.utcnow():\n-                    old.append(id_)\n-            for id_ in old:  # Remove gathered events\n-                del dict_[id_]\n+            now = datetime.utcnow()\n+            for id_, expiration in dict_.items():","path":"PokeAlarm/Cache/Cache.py","position":46,"original_position":46,"commit_id":"38e01cddd8ef8a0376e9984ff69092cf7acdc000","original_commit_id":"38e01cddd8ef8a0376e9984ff69092cf7acdc000","user":{"login":"kvangent","id":10712294,"avatar_url":"https://avatars1.githubusercontent.com/u/10712294?v=4","gravatar_id":"","url":"https://api.github.com/users/kvangent","html_url":"https://github.com/kvangent","followers_url":"https://api.github.com/users/kvangent/followers","following_url":"https://api.github.com/users/kvangent/following{/other_user}","gists_url":"https://api.github.com/users/kvangent/gists{/gist_id}","starred_url":"https://api.github.com/users/kvangent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvangent/subscriptions","organizations_url":"https://api.github.com/users/kvangent/orgs","repos_url":"https://api.github.com/users/kvangent/repos","events_url":"https://api.github.com/users/kvangent/events{/privacy}","received_events_url":"https://api.github.com/users/kvangent/received_events","type":"User","site_admin":false},"body":"`id_` --> `time` for the same reason","created_at":"2017-11-08T21:37:20Z","updated_at":"2017-11-08T21:40:26Z","html_url":"https://github.com/PokeAlarm/PokeAlarm/pull/472#discussion_r149803972","pull_request_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/472","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/comments/149803972"},"html":{"href":"https://github.com/PokeAlarm/PokeAlarm/pull/472#discussion_r149803972"},"pull_request":{"href":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/472"}}},"pull_request":{"url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/472","id":151373400,"html_url":"https://github.com/PokeAlarm/PokeAlarm/pull/472","diff_url":"https://github.com/PokeAlarm/PokeAlarm/pull/472.diff","patch_url":"https://github.com/PokeAlarm/PokeAlarm/pull/472.patch","issue_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/issues/472","number":472,"state":"open","locked":false,"title":"Fix FileCache not getting cleaned","user":{"login":"sLoPPydrive","id":3931865,"avatar_url":"https://avatars1.githubusercontent.com/u/3931865?v=4","gravatar_id":"","url":"https://api.github.com/users/sLoPPydrive","html_url":"https://github.com/sLoPPydrive","followers_url":"https://api.github.com/users/sLoPPydrive/followers","following_url":"https://api.github.com/users/sLoPPydrive/following{/other_user}","gists_url":"https://api.github.com/users/sLoPPydrive/gists{/gist_id}","starred_url":"https://api.github.com/users/sLoPPydrive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sLoPPydrive/subscriptions","organizations_url":"https://api.github.com/users/sLoPPydrive/orgs","repos_url":"https://api.github.com/users/sLoPPydrive/repos","events_url":"https://api.github.com/users/sLoPPydrive/events{/privacy}","received_events_url":"https://api.github.com/users/sLoPPydrive/received_events","type":"User","site_admin":false},"body":"...plus some typos and a smaller clean_hist function\r\n\r\n## Description\r\nThe `FileCache` wasn't getting cleaned. Only the data got stored which led to notifications not being sent.\r\n\r\nThe commit also corrects some typos in `FileCache.py` and replaces the clean_hist double-loop with a single loop according to https://stackoverflow.com/a/5385075/2787955\r\n\r\n## Type of Change\r\n- [X] Bug fix (non-breaking change which fixes an issue)\r\n- [ ] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (would cause existing functionality to change)\r\n\r\n## Motivation and Context\r\nBugfixing\r\n\r\n## How Has This Been Tested?\r\nMy local map\r\n\r\n## Wiki Update\r\n- [ ] This change requires an update to the Wiki.\r\n- [X] This change does not require an update to the Wiki.\r\n\r\n\r\n## Checklist\r\n- [X] This change follows the code style of this project.\r\n- [ ] This change only changes what is necessary to the feature.\r\n","created_at":"2017-11-08T12:47:29Z","updated_at":"2017-11-08T21:40:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aee4a7999c9ad79a0da0f5e63d89b2a38fbf0a8d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/472/commits","review_comments_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/472/comments","review_comment_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/issues/472/comments","statuses_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/statuses/38e01cddd8ef8a0376e9984ff69092cf7acdc000","head":{"label":"sLoPPydrive:P-MoreCacheFixes","ref":"P-MoreCacheFixes","sha":"38e01cddd8ef8a0376e9984ff69092cf7acdc000","user":{"login":"sLoPPydrive","id":3931865,"avatar_url":"https://avatars1.githubusercontent.com/u/3931865?v=4","gravatar_id":"","url":"https://api.github.com/users/sLoPPydrive","html_url":"https://github.com/sLoPPydrive","followers_url":"https://api.github.com/users/sLoPPydrive/followers","following_url":"https://api.github.com/users/sLoPPydrive/following{/other_user}","gists_url":"https://api.github.com/users/sLoPPydrive/gists{/gist_id}","starred_url":"https://api.github.com/users/sLoPPydrive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sLoPPydrive/subscriptions","organizations_url":"https://api.github.com/users/sLoPPydrive/orgs","repos_url":"https://api.github.com/users/sLoPPydrive/repos","events_url":"https://api.github.com/users/sLoPPydrive/events{/privacy}","received_events_url":"https://api.github.com/users/sLoPPydrive/received_events","type":"User","site_admin":false},"repo":{"id":66630996,"name":"PokeAlarm","full_name":"sLoPPydrive/PokeAlarm","owner":{"login":"sLoPPydrive","id":3931865,"avatar_url":"https://avatars1.githubusercontent.com/u/3931865?v=4","gravatar_id":"","url":"https://api.github.com/users/sLoPPydrive","html_url":"https://github.com/sLoPPydrive","followers_url":"https://api.github.com/users/sLoPPydrive/followers","following_url":"https://api.github.com/users/sLoPPydrive/following{/other_user}","gists_url":"https://api.github.com/users/sLoPPydrive/gists{/gist_id}","starred_url":"https://api.github.com/users/sLoPPydrive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sLoPPydrive/subscriptions","organizations_url":"https://api.github.com/users/sLoPPydrive/orgs","repos_url":"https://api.github.com/users/sLoPPydrive/repos","events_url":"https://api.github.com/users/sLoPPydrive/events{/privacy}","received_events_url":"https://api.github.com/users/sLoPPydrive/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sLoPPydrive/PokeAlarm","description":"Please see my Blog for any news about changes to this fork:","fork":true,"url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm","forks_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/forks","keys_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/teams","hooks_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/hooks","issue_events_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/issues/events{/number}","events_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/events","assignees_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/assignees{/user}","branches_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/branches{/branch}","tags_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/tags","blobs_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/statuses/{sha}","languages_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/languages","stargazers_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/stargazers","contributors_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/contributors","subscribers_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/subscribers","subscription_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/subscription","commits_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/contents/{+path}","compare_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/merges","archive_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/downloads","issues_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/issues{/number}","pulls_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/pulls{/number}","milestones_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/milestones{/number}","notifications_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/labels{/name}","releases_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/releases{/id}","deployments_url":"https://api.github.com/repos/sLoPPydrive/PokeAlarm/deployments","created_at":"2016-08-26T08:31:15Z","updated_at":"2017-05-16T12:47:00Z","pushed_at":"2017-11-08T21:31:43Z","git_url":"git://github.com/sLoPPydrive/PokeAlarm.git","ssh_url":"git@github.com:sLoPPydrive/PokeAlarm.git","clone_url":"https://github.com/sLoPPydrive/PokeAlarm.git","svn_url":"https://github.com/sLoPPydrive/PokeAlarm","homepage":"https://sloppydrive.jimdo.com/","size":18735,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":7,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"PokeAlarm:dev","ref":"dev","sha":"394890b4349d10bd9a96b2789fe58454f185d5cf","user":{"login":"PokeAlarm","id":32808286,"avatar_url":"https://avatars0.githubusercontent.com/u/32808286?v=4","gravatar_id":"","url":"https://api.github.com/users/PokeAlarm","html_url":"https://github.com/PokeAlarm","followers_url":"https://api.github.com/users/PokeAlarm/followers","following_url":"https://api.github.com/users/PokeAlarm/following{/other_user}","gists_url":"https://api.github.com/users/PokeAlarm/gists{/gist_id}","starred_url":"https://api.github.com/users/PokeAlarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PokeAlarm/subscriptions","organizations_url":"https://api.github.com/users/PokeAlarm/orgs","repos_url":"https://api.github.com/users/PokeAlarm/repos","events_url":"https://api.github.com/users/PokeAlarm/events{/privacy}","received_events_url":"https://api.github.com/users/PokeAlarm/received_events","type":"Organization","site_admin":false},"repo":{"id":64392484,"name":"PokeAlarm","full_name":"PokeAlarm/PokeAlarm","owner":{"login":"PokeAlarm","id":32808286,"avatar_url":"https://avatars0.githubusercontent.com/u/32808286?v=4","gravatar_id":"","url":"https://api.github.com/users/PokeAlarm","html_url":"https://github.com/PokeAlarm","followers_url":"https://api.github.com/users/PokeAlarm/followers","following_url":"https://api.github.com/users/PokeAlarm/following{/other_user}","gists_url":"https://api.github.com/users/PokeAlarm/gists{/gist_id}","starred_url":"https://api.github.com/users/PokeAlarm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PokeAlarm/subscriptions","organizations_url":"https://api.github.com/users/PokeAlarm/orgs","repos_url":"https://api.github.com/users/PokeAlarm/repos","events_url":"https://api.github.com/users/PokeAlarm/events{/privacy}","received_events_url":"https://api.github.com/users/PokeAlarm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PokeAlarm/PokeAlarm","description":"PokeAlarm is a third party extension for RocketMap that allows you to receive external notifications via the service of your choice","fork":false,"url":"https://api.github.com/repos/PokeAlarm/PokeAlarm","forks_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/forks","keys_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/teams","hooks_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/hooks","issue_events_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/issues/events{/number}","events_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/events","assignees_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/assignees{/user}","branches_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/branches{/branch}","tags_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/tags","blobs_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/statuses/{sha}","languages_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/languages","stargazers_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/stargazers","contributors_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/contributors","subscribers_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/subscribers","subscription_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/subscription","commits_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/contents/{+path}","compare_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/merges","archive_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/downloads","issues_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/issues{/number}","pulls_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls{/number}","milestones_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/milestones{/number}","notifications_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/labels{/name}","releases_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/releases{/id}","deployments_url":"https://api.github.com/repos/PokeAlarm/PokeAlarm/deployments","created_at":"2016-07-28T12:08:26Z","updated_at":"2017-11-05T00:12:44Z","pushed_at":"2017-11-08T21:31:44Z","git_url":"git://github.com/PokeAlarm/PokeAlarm.git","ssh_url":"git@github.com:PokeAlarm/PokeAlarm.git","clone_url":"https://github.com/PokeAlarm/PokeAlarm.git","svn_url":"https://github.com/PokeAlarm/PokeAlarm","homepage":"","size":18644,"stargazers_count":278,"watchers_count":278,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":270,"mirror_url":null,"archived":false,"open_issues_count":19,"forks":270,"open_issues":19,"watchers":278,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/472"},"html":{"href":"https://github.com/PokeAlarm/PokeAlarm/pull/472"},"issue":{"href":"https://api.github.com/repos/PokeAlarm/PokeAlarm/issues/472"},"comments":{"href":"https://api.github.com/repos/PokeAlarm/PokeAlarm/issues/472/comments"},"review_comments":{"href":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/472/comments"},"review_comment":{"href":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PokeAlarm/PokeAlarm/pulls/472/commits"},"statuses":{"href":"https://api.github.com/repos/PokeAlarm/PokeAlarm/statuses/38e01cddd8ef8a0376e9984ff69092cf7acdc000"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kvangent"}}