{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/crawler/issues/150","repository_url":"https://api.github.com/repos/spatie/crawler","labels_url":"https://api.github.com/repos/spatie/crawler/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/spatie/crawler/issues/150/comments","events_url":"https://api.github.com/repos/spatie/crawler/issues/150/events","html_url":"https://github.com/spatie/crawler/pull/150","id":323106927,"node_id":"MDExOlB1bGxSZXF1ZXN0MTg4MDQzODA2","number":150,"title":"Code refactor","user":{"login":"brendt","id":6905297,"node_id":"MDQ6VXNlcjY5MDUyOTc=","avatar_url":"https://avatars3.githubusercontent.com/u/6905297?v=4","gravatar_id":"","url":"https://api.github.com/users/brendt","html_url":"https://github.com/brendt","followers_url":"https://api.github.com/users/brendt/followers","following_url":"https://api.github.com/users/brendt/following{/other_user}","gists_url":"https://api.github.com/users/brendt/gists{/gist_id}","starred_url":"https://api.github.com/users/brendt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendt/subscriptions","organizations_url":"https://api.github.com/users/brendt/orgs","repos_url":"https://api.github.com/users/brendt/repos","events_url":"https://api.github.com/users/brendt/events{/privacy}","received_events_url":"https://api.github.com/users/brendt/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"brendt","id":6905297,"node_id":"MDQ6VXNlcjY5MDUyOTc=","avatar_url":"https://avatars3.githubusercontent.com/u/6905297?v=4","gravatar_id":"","url":"https://api.github.com/users/brendt","html_url":"https://github.com/brendt","followers_url":"https://api.github.com/users/brendt/followers","following_url":"https://api.github.com/users/brendt/following{/other_user}","gists_url":"https://api.github.com/users/brendt/gists{/gist_id}","starred_url":"https://api.github.com/users/brendt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendt/subscriptions","organizations_url":"https://api.github.com/users/brendt/orgs","repos_url":"https://api.github.com/users/brendt/repos","events_url":"https://api.github.com/users/brendt/events{/privacy}","received_events_url":"https://api.github.com/users/brendt/received_events","type":"User","site_admin":false},"assignees":[{"login":"brendt","id":6905297,"node_id":"MDQ6VXNlcjY5MDUyOTc=","avatar_url":"https://avatars3.githubusercontent.com/u/6905297?v=4","gravatar_id":"","url":"https://api.github.com/users/brendt","html_url":"https://github.com/brendt","followers_url":"https://api.github.com/users/brendt/followers","following_url":"https://api.github.com/users/brendt/following{/other_user}","gists_url":"https://api.github.com/users/brendt/gists{/gist_id}","starred_url":"https://api.github.com/users/brendt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendt/subscriptions","organizations_url":"https://api.github.com/users/brendt/orgs","repos_url":"https://api.github.com/users/brendt/repos","events_url":"https://api.github.com/users/brendt/events{/privacy}","received_events_url":"https://api.github.com/users/brendt/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-05-15T08:00:30Z","updated_at":"2018-06-05T08:10:43Z","closed_at":"2018-06-05T08:10:30Z","author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/spatie/crawler/pulls/150","html_url":"https://github.com/spatie/crawler/pull/150","diff_url":"https://github.com/spatie/crawler/pull/150.diff","patch_url":"https://github.com/spatie/crawler/pull/150.patch"},"body":"I was working on #142 and #143 when I noticed that I was adding more and more logic in the same functions, making them very long. I also did this when I recently added robots.txt check, and I feel we can do better.\r\n\r\nThis PR proposes a first, simple, refactor. I've moved the logic to handle a request's success or failure to separate classes, each having their own dependencies. There are a lot more things that can be split, and the dependencies given to both handlers can be optimised.\r\n\r\nI think a review at this point is necessary though, to make sure we're on the right track. If the PR as it is now is merged, it will already result in a cleaner solution for the issues mentioned above. I can also spend more time to further structure and split the code better. Th result would be a simpler to navigate codebase, where it's simpler for newer devs of this package, like me, to know what happens where, instead of the huge class right now.\r\n\r\nAnyways, feedback is appreciated."},"comment":{"url":"https://api.github.com/repos/spatie/crawler/issues/comments/394620873","html_url":"https://github.com/spatie/crawler/pull/150#issuecomment-394620873","issue_url":"https://api.github.com/repos/spatie/crawler/issues/150","id":394620873,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDYyMDg3Mw==","user":{"login":"freekmurze","id":483853,"node_id":"MDQ6VXNlcjQ4Mzg1Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/483853?v=4","gravatar_id":"","url":"https://api.github.com/users/freekmurze","html_url":"https://github.com/freekmurze","followers_url":"https://api.github.com/users/freekmurze/followers","following_url":"https://api.github.com/users/freekmurze/following{/other_user}","gists_url":"https://api.github.com/users/freekmurze/gists{/gist_id}","starred_url":"https://api.github.com/users/freekmurze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freekmurze/subscriptions","organizations_url":"https://api.github.com/users/freekmurze/orgs","repos_url":"https://api.github.com/users/freekmurze/repos","events_url":"https://api.github.com/users/freekmurze/events{/privacy}","received_events_url":"https://api.github.com/users/freekmurze/received_events","type":"User","site_admin":false},"created_at":"2018-06-05T08:10:43Z","updated_at":"2018-06-05T08:10:43Z","author_association":"MEMBER","body":"Very nice refactor 👍 "}}
{"actor":{"display_login":"freekmurze"}}