{"action":"created","comment":{"url":"https://api.github.com/repos/Pylons/pyramid/pulls/comments/44803816","id":44803816,"diff_hunk":"@@ -892,25 +893,34 @@ def check_reload(self):\n                 pyc = True\n             else:\n                 pyc = False\n-            if filename not in self.module_mtimes:\n-                self.module_mtimes[filename] = mtime\n-            elif self.module_mtimes[filename] < mtime:\n+            old_mtime = self.module_mtimes.get(filename)\n+            self.module_mtimes[filename] = mtime\n+            if old_mtime is not None and old_mtime < mtime:\n+                self.pending_reload = True\n                 if pyc:\n                     filename = filename[:-1]\n-                # check if a file has syntax errors. If so, track it until it's fixed\n-                for filename_promise in self.syntax_error_files + [filename]:\n-                    try:\n-                        py_compile.compile(filename_promise, doraise=True)\n-                    except py_compile.PyCompileError:\n-                        print(\"%s has a SyntaxError; NOT reloading.\" % filename_promise)\n-                        if filename_promise not in self.syntax_error_files:\n-                            self.syntax_error_files.append(filename_promise)\n-                    else:\n-                        if filename_promise in self.syntax_error_files:\n-                            self.syntax_error_files.remove(filename_promise)\n-                if not self.syntax_error_files:\n-                    print(\"%s changed; reloading...\" % filename)\n-                    return False\n+                is_valid = True\n+                if filename.endswith('.py'):\n+                    is_valid = self.check_syntax(filename)\n+                if is_valid:\n+                    print(\"%s changed ...\" % filename)\n+        if self.pending_reload and not self.syntax_error_files:\n+            self.pending_reload = False\n+            return False\n+        return True\n+\n+    def check_syntax(self, filename):\n+        # check if a file has syntax errors.\n+        # If so, track it until it's fixed.\n+        try:\n+            py_compile.compile(filename, doraise=True)\n+        except py_compile.PyCompileError:\n+            print(\"%s has a SyntaxError; NOT reloading.\" % filename)","path":"pyramid/scripts/pserve.py","position":53,"original_position":53,"commit_id":"565058df3e98ba45945b6254b5c69c3de399bcb7","original_commit_id":"565058df3e98ba45945b6254b5c69c3de399bcb7","user":{"login":"domenkozar","id":126339,"avatar_url":"https://avatars.githubusercontent.com/u/126339?v=3","gravatar_id":"","url":"https://api.github.com/users/domenkozar","html_url":"https://github.com/domenkozar","followers_url":"https://api.github.com/users/domenkozar/followers","following_url":"https://api.github.com/users/domenkozar/following{/other_user}","gists_url":"https://api.github.com/users/domenkozar/gists{/gist_id}","starred_url":"https://api.github.com/users/domenkozar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenkozar/subscriptions","organizations_url":"https://api.github.com/users/domenkozar/orgs","repos_url":"https://api.github.com/users/domenkozar/repos","events_url":"https://api.github.com/users/domenkozar/events{/privacy}","received_events_url":"https://api.github.com/users/domenkozar/received_events","type":"User","site_admin":false},"body":"But the information you're looking for is what files to fix to get reloader to work again","created_at":"2015-11-13T16:42:50Z","updated_at":"2015-11-13T16:42:50Z","html_url":"https://github.com/Pylons/pyramid/pull/2049#discussion_r44803816","pull_request_url":"https://api.github.com/repos/Pylons/pyramid/pulls/2049","_links":{"self":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/comments/44803816"},"html":{"href":"https://github.com/Pylons/pyramid/pull/2049#discussion_r44803816"},"pull_request":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/2049"}}},"pull_request":{"url":"https://api.github.com/repos/Pylons/pyramid/pulls/2049","id":49040462,"html_url":"https://github.com/Pylons/pyramid/pull/2049","diff_url":"https://github.com/Pylons/pyramid/pull/2049.diff","patch_url":"https://github.com/Pylons/pyramid/pull/2049.patch","issue_url":"https://api.github.com/repos/Pylons/pyramid/issues/2049","number":2049,"state":"open","locked":false,"title":"avoid spamming by outputting state only once when a file changes","user":{"login":"mmerickel","id":487237,"avatar_url":"https://avatars.githubusercontent.com/u/487237?v=3","gravatar_id":"","url":"https://api.github.com/users/mmerickel","html_url":"https://github.com/mmerickel","followers_url":"https://api.github.com/users/mmerickel/followers","following_url":"https://api.github.com/users/mmerickel/following{/other_user}","gists_url":"https://api.github.com/users/mmerickel/gists{/gist_id}","starred_url":"https://api.github.com/users/mmerickel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmerickel/subscriptions","organizations_url":"https://api.github.com/users/mmerickel/orgs","repos_url":"https://api.github.com/users/mmerickel/repos","events_url":"https://api.github.com/users/mmerickel/events{/privacy}","received_events_url":"https://api.github.com/users/mmerickel/received_events","type":"User","site_admin":false},"body":"This reduces the output to only when a file changes. However, I'm able to get it into a weird state where it keeps spamming and I haven't figured out the fix for that yet.\r\n\r\n1) start `pserve --reload`\r\n2) save a syntax error to file A.py\r\n3) save file B.py with no changes\r\n4) you will see a continued output of \"B.py changed ...\" on the console.\r\n\r\nIt doesn't happen every time but it's somewhat consistent for me (especially when B.py is pserve.py).","created_at":"2015-10-28T17:34:36Z","updated_at":"2015-11-13T16:42:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18413d8c8cc9007f38fa60f3b5184346868fa448","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Pylons/pyramid/pulls/2049/commits","review_comments_url":"https://api.github.com/repos/Pylons/pyramid/pulls/2049/comments","review_comment_url":"https://api.github.com/repos/Pylons/pyramid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Pylons/pyramid/issues/2049/comments","statuses_url":"https://api.github.com/repos/Pylons/pyramid/statuses/565058df3e98ba45945b6254b5c69c3de399bcb7","head":{"label":"Pylons:fix/pserve-reload-verbosity","ref":"fix/pserve-reload-verbosity","sha":"565058df3e98ba45945b6254b5c69c3de399bcb7","user":{"login":"Pylons","id":452227,"avatar_url":"https://avatars.githubusercontent.com/u/452227?v=3","gravatar_id":"","url":"https://api.github.com/users/Pylons","html_url":"https://github.com/Pylons","followers_url":"https://api.github.com/users/Pylons/followers","following_url":"https://api.github.com/users/Pylons/following{/other_user}","gists_url":"https://api.github.com/users/Pylons/gists{/gist_id}","starred_url":"https://api.github.com/users/Pylons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pylons/subscriptions","organizations_url":"https://api.github.com/users/Pylons/orgs","repos_url":"https://api.github.com/users/Pylons/repos","events_url":"https://api.github.com/users/Pylons/events{/privacy}","received_events_url":"https://api.github.com/users/Pylons/received_events","type":"Organization","site_admin":false},"repo":{"id":1020639,"name":"pyramid","full_name":"Pylons/pyramid","owner":{"login":"Pylons","id":452227,"avatar_url":"https://avatars.githubusercontent.com/u/452227?v=3","gravatar_id":"","url":"https://api.github.com/users/Pylons","html_url":"https://github.com/Pylons","followers_url":"https://api.github.com/users/Pylons/followers","following_url":"https://api.github.com/users/Pylons/following{/other_user}","gists_url":"https://api.github.com/users/Pylons/gists{/gist_id}","starred_url":"https://api.github.com/users/Pylons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pylons/subscriptions","organizations_url":"https://api.github.com/users/Pylons/orgs","repos_url":"https://api.github.com/users/Pylons/repos","events_url":"https://api.github.com/users/Pylons/events{/privacy}","received_events_url":"https://api.github.com/users/Pylons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Pylons/pyramid","description":"Pyramid web framework","fork":false,"url":"https://api.github.com/repos/Pylons/pyramid","forks_url":"https://api.github.com/repos/Pylons/pyramid/forks","keys_url":"https://api.github.com/repos/Pylons/pyramid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Pylons/pyramid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Pylons/pyramid/teams","hooks_url":"https://api.github.com/repos/Pylons/pyramid/hooks","issue_events_url":"https://api.github.com/repos/Pylons/pyramid/issues/events{/number}","events_url":"https://api.github.com/repos/Pylons/pyramid/events","assignees_url":"https://api.github.com/repos/Pylons/pyramid/assignees{/user}","branches_url":"https://api.github.com/repos/Pylons/pyramid/branches{/branch}","tags_url":"https://api.github.com/repos/Pylons/pyramid/tags","blobs_url":"https://api.github.com/repos/Pylons/pyramid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Pylons/pyramid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Pylons/pyramid/git/refs{/sha}","trees_url":"https://api.github.com/repos/Pylons/pyramid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Pylons/pyramid/statuses/{sha}","languages_url":"https://api.github.com/repos/Pylons/pyramid/languages","stargazers_url":"https://api.github.com/repos/Pylons/pyramid/stargazers","contributors_url":"https://api.github.com/repos/Pylons/pyramid/contributors","subscribers_url":"https://api.github.com/repos/Pylons/pyramid/subscribers","subscription_url":"https://api.github.com/repos/Pylons/pyramid/subscription","commits_url":"https://api.github.com/repos/Pylons/pyramid/commits{/sha}","git_commits_url":"https://api.github.com/repos/Pylons/pyramid/git/commits{/sha}","comments_url":"https://api.github.com/repos/Pylons/pyramid/comments{/number}","issue_comment_url":"https://api.github.com/repos/Pylons/pyramid/issues/comments{/number}","contents_url":"https://api.github.com/repos/Pylons/pyramid/contents/{+path}","compare_url":"https://api.github.com/repos/Pylons/pyramid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Pylons/pyramid/merges","archive_url":"https://api.github.com/repos/Pylons/pyramid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Pylons/pyramid/downloads","issues_url":"https://api.github.com/repos/Pylons/pyramid/issues{/number}","pulls_url":"https://api.github.com/repos/Pylons/pyramid/pulls{/number}","milestones_url":"https://api.github.com/repos/Pylons/pyramid/milestones{/number}","notifications_url":"https://api.github.com/repos/Pylons/pyramid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Pylons/pyramid/labels{/name}","releases_url":"https://api.github.com/repos/Pylons/pyramid/releases{/id}","created_at":"2010-10-24T22:00:35Z","updated_at":"2015-11-13T13:58:06Z","pushed_at":"2015-11-13T14:02:56Z","git_url":"git://github.com/Pylons/pyramid.git","ssh_url":"git@github.com:Pylons/pyramid.git","clone_url":"https://github.com/Pylons/pyramid.git","svn_url":"https://github.com/Pylons/pyramid","homepage":"http://docs.pylonsproject.org/en/latest/docs/pyramid.html","size":33377,"stargazers_count":1817,"watchers_count":1817,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":621,"mirror_url":null,"open_issues_count":127,"forks":621,"open_issues":127,"watchers":1817,"default_branch":"master"}},"base":{"label":"Pylons:pserve_reload_syntaxerror_handler","ref":"pserve_reload_syntaxerror_handler","sha":"315b19e8ea997f6b10c23dffa65d831aa42f3563","user":{"login":"Pylons","id":452227,"avatar_url":"https://avatars.githubusercontent.com/u/452227?v=3","gravatar_id":"","url":"https://api.github.com/users/Pylons","html_url":"https://github.com/Pylons","followers_url":"https://api.github.com/users/Pylons/followers","following_url":"https://api.github.com/users/Pylons/following{/other_user}","gists_url":"https://api.github.com/users/Pylons/gists{/gist_id}","starred_url":"https://api.github.com/users/Pylons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pylons/subscriptions","organizations_url":"https://api.github.com/users/Pylons/orgs","repos_url":"https://api.github.com/users/Pylons/repos","events_url":"https://api.github.com/users/Pylons/events{/privacy}","received_events_url":"https://api.github.com/users/Pylons/received_events","type":"Organization","site_admin":false},"repo":{"id":1020639,"name":"pyramid","full_name":"Pylons/pyramid","owner":{"login":"Pylons","id":452227,"avatar_url":"https://avatars.githubusercontent.com/u/452227?v=3","gravatar_id":"","url":"https://api.github.com/users/Pylons","html_url":"https://github.com/Pylons","followers_url":"https://api.github.com/users/Pylons/followers","following_url":"https://api.github.com/users/Pylons/following{/other_user}","gists_url":"https://api.github.com/users/Pylons/gists{/gist_id}","starred_url":"https://api.github.com/users/Pylons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pylons/subscriptions","organizations_url":"https://api.github.com/users/Pylons/orgs","repos_url":"https://api.github.com/users/Pylons/repos","events_url":"https://api.github.com/users/Pylons/events{/privacy}","received_events_url":"https://api.github.com/users/Pylons/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Pylons/pyramid","description":"Pyramid web framework","fork":false,"url":"https://api.github.com/repos/Pylons/pyramid","forks_url":"https://api.github.com/repos/Pylons/pyramid/forks","keys_url":"https://api.github.com/repos/Pylons/pyramid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Pylons/pyramid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Pylons/pyramid/teams","hooks_url":"https://api.github.com/repos/Pylons/pyramid/hooks","issue_events_url":"https://api.github.com/repos/Pylons/pyramid/issues/events{/number}","events_url":"https://api.github.com/repos/Pylons/pyramid/events","assignees_url":"https://api.github.com/repos/Pylons/pyramid/assignees{/user}","branches_url":"https://api.github.com/repos/Pylons/pyramid/branches{/branch}","tags_url":"https://api.github.com/repos/Pylons/pyramid/tags","blobs_url":"https://api.github.com/repos/Pylons/pyramid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Pylons/pyramid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Pylons/pyramid/git/refs{/sha}","trees_url":"https://api.github.com/repos/Pylons/pyramid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Pylons/pyramid/statuses/{sha}","languages_url":"https://api.github.com/repos/Pylons/pyramid/languages","stargazers_url":"https://api.github.com/repos/Pylons/pyramid/stargazers","contributors_url":"https://api.github.com/repos/Pylons/pyramid/contributors","subscribers_url":"https://api.github.com/repos/Pylons/pyramid/subscribers","subscription_url":"https://api.github.com/repos/Pylons/pyramid/subscription","commits_url":"https://api.github.com/repos/Pylons/pyramid/commits{/sha}","git_commits_url":"https://api.github.com/repos/Pylons/pyramid/git/commits{/sha}","comments_url":"https://api.github.com/repos/Pylons/pyramid/comments{/number}","issue_comment_url":"https://api.github.com/repos/Pylons/pyramid/issues/comments{/number}","contents_url":"https://api.github.com/repos/Pylons/pyramid/contents/{+path}","compare_url":"https://api.github.com/repos/Pylons/pyramid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Pylons/pyramid/merges","archive_url":"https://api.github.com/repos/Pylons/pyramid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Pylons/pyramid/downloads","issues_url":"https://api.github.com/repos/Pylons/pyramid/issues{/number}","pulls_url":"https://api.github.com/repos/Pylons/pyramid/pulls{/number}","milestones_url":"https://api.github.com/repos/Pylons/pyramid/milestones{/number}","notifications_url":"https://api.github.com/repos/Pylons/pyramid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Pylons/pyramid/labels{/name}","releases_url":"https://api.github.com/repos/Pylons/pyramid/releases{/id}","created_at":"2010-10-24T22:00:35Z","updated_at":"2015-11-13T13:58:06Z","pushed_at":"2015-11-13T14:02:56Z","git_url":"git://github.com/Pylons/pyramid.git","ssh_url":"git@github.com:Pylons/pyramid.git","clone_url":"https://github.com/Pylons/pyramid.git","svn_url":"https://github.com/Pylons/pyramid","homepage":"http://docs.pylonsproject.org/en/latest/docs/pyramid.html","size":33377,"stargazers_count":1817,"watchers_count":1817,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":621,"mirror_url":null,"open_issues_count":127,"forks":621,"open_issues":127,"watchers":1817,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/2049"},"html":{"href":"https://github.com/Pylons/pyramid/pull/2049"},"issue":{"href":"https://api.github.com/repos/Pylons/pyramid/issues/2049"},"comments":{"href":"https://api.github.com/repos/Pylons/pyramid/issues/2049/comments"},"review_comments":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/2049/comments"},"review_comment":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Pylons/pyramid/pulls/2049/commits"},"statuses":{"href":"https://api.github.com/repos/Pylons/pyramid/statuses/565058df3e98ba45945b6254b5c69c3de399bcb7"}}}}