{"action":"created","issue":{"url":"https://api.github.com/repos/ForbesLindesay/browserify-middleware/issues/83","labels_url":"https://api.github.com/repos/ForbesLindesay/browserify-middleware/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/ForbesLindesay/browserify-middleware/issues/83/comments","events_url":"https://api.github.com/repos/ForbesLindesay/browserify-middleware/issues/83/events","html_url":"https://github.com/ForbesLindesay/browserify-middleware/pull/83","id":87007037,"number":83,"title":"Use watchify for caching","user":{"login":"ForbesLindesay","id":1260646,"avatar_url":"https://avatars.githubusercontent.com/u/1260646?v=3","gravatar_id":"","url":"https://api.github.com/users/ForbesLindesay","html_url":"https://github.com/ForbesLindesay","followers_url":"https://api.github.com/users/ForbesLindesay/followers","following_url":"https://api.github.com/users/ForbesLindesay/following{/other_user}","gists_url":"https://api.github.com/users/ForbesLindesay/gists{/gist_id}","starred_url":"https://api.github.com/users/ForbesLindesay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ForbesLindesay/subscriptions","organizations_url":"https://api.github.com/users/ForbesLindesay/orgs","repos_url":"https://api.github.com/users/ForbesLindesay/repos","events_url":"https://api.github.com/users/ForbesLindesay/events{/privacy}","received_events_url":"https://api.github.com/users/ForbesLindesay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-10T15:25:52Z","updated_at":"2015-06-12T13:42:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ForbesLindesay/browserify-middleware/pulls/83","html_url":"https://github.com/ForbesLindesay/browserify-middleware/pull/83","diff_url":"https://github.com/ForbesLindesay/browserify-middleware/pull/83.diff","patch_url":"https://github.com/ForbesLindesay/browserify-middleware/pull/83.patch"},"body":"Maintaining our own dynamic caching system separately from @substack has been a constant source of errors.  Switching to watchify has the downside that we will be polling for changes constantly, rather than just checking for changes when the user hits refresh.  Polling every 100ms should be fine on most people's systems though.  The code looks a little more complex than it might seem like it needs to be because I made watchify notify browserify-middleware immediately of any change so that we can ensure that any requests that come in during the 600ms wait period (that's required to ensure the disk has finished working) are queued until the new bundle is ready.\r\n\r\nThis also makes caching much simpler by pushing the cached object into being part of the `browserify` handler rather than storing a global mapping between some ID and some cache object.\r\n\r\n@adius could you test this out and let me know if it works/if it needs any improvements?\r\n@killroy42 this will implement the async postcompile hook that you requested, via a Promise based interface.\r\n@gabegorelick, @allain & @scottbrady I'd appreciate if one of you could review this change for me and check it all looks sensible to you.  If you are happy with it, feel free to merge and release."},"comment":{"url":"https://api.github.com/repos/ForbesLindesay/browserify-middleware/issues/comments/111496457","html_url":"https://github.com/ForbesLindesay/browserify-middleware/pull/83#issuecomment-111496457","issue_url":"https://api.github.com/repos/ForbesLindesay/browserify-middleware/issues/83","id":111496457,"user":{"login":"adius","id":969983,"avatar_url":"https://avatars.githubusercontent.com/u/969983?v=3","gravatar_id":"","url":"https://api.github.com/users/adius","html_url":"https://github.com/adius","followers_url":"https://api.github.com/users/adius/followers","following_url":"https://api.github.com/users/adius/following{/other_user}","gists_url":"https://api.github.com/users/adius/gists{/gist_id}","starred_url":"https://api.github.com/users/adius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adius/subscriptions","organizations_url":"https://api.github.com/users/adius/orgs","repos_url":"https://api.github.com/users/adius/repos","events_url":"https://api.github.com/users/adius/events{/privacy}","received_events_url":"https://api.github.com/users/adius/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T13:42:23Z","updated_at":"2015-06-12T13:42:23Z","body":"I didn't have any problems … and it is a lot faster. =) Thanks!"}}