{"action":"created","issue":{"url":"https://api.github.com/repos/wkh237/react-native-fetch-blob/issues/331","repository_url":"https://api.github.com/repos/wkh237/react-native-fetch-blob","labels_url":"https://api.github.com/repos/wkh237/react-native-fetch-blob/issues/331/labels{/name}","comments_url":"https://api.github.com/repos/wkh237/react-native-fetch-blob/issues/331/comments","events_url":"https://api.github.com/repos/wkh237/react-native-fetch-blob/issues/331/events","html_url":"https://github.com/wkh237/react-native-fetch-blob/issues/331","id":221935078,"number":331,"title":"Race condition with config() and cancel()","user":{"login":"wcandillon","id":306134,"avatar_url":"https://avatars2.githubusercontent.com/u/306134?v=3","gravatar_id":"","url":"https://api.github.com/users/wcandillon","html_url":"https://github.com/wcandillon","followers_url":"https://api.github.com/users/wcandillon/followers","following_url":"https://api.github.com/users/wcandillon/following{/other_user}","gists_url":"https://api.github.com/users/wcandillon/gists{/gist_id}","starred_url":"https://api.github.com/users/wcandillon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wcandillon/subscriptions","organizations_url":"https://api.github.com/users/wcandillon/orgs","repos_url":"https://api.github.com/users/wcandillon/repos","events_url":"https://api.github.com/users/wcandillon/events{/privacy}","received_events_url":"https://api.github.com/users/wcandillon/received_events","type":"User","site_admin":false},"labels":[{"id":381982119,"url":"https://api.github.com/repos/wkh237/react-native-fetch-blob/labels/discussion","name":"discussion","color":"fef2c0","default":false},{"id":380948108,"url":"https://api.github.com/repos/wkh237/react-native-fetch-blob/labels/needs%20investigation","name":"needs investigation","color":"bfdadc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-04-15T08:18:50Z","updated_at":"2017-04-15T15:31:01Z","closed_at":"2017-04-15T15:31:01Z","body":"@wkh237 First things first, thank you for this amazing library!\r\n\r\nI found a race condition between `config()` and `cancel()` which seems fairly easy to reproduce.\r\nThis race condition leads to broken images such as this one: https://www.dropbox.com/s/euwx03cglbuuu1h/Screenshot%202017-04-15%2010.16.26.png?dl=0 or https://github.com/facebook/react-native/issues/9893.\r\n\r\n```js\r\ncache.task = RNFetchBlob.config({ path }).fetch(\"GET\", uri, {});\r\ncache.task.catch(error => {\r\n  console.log(error);\r\n//This below should always return false but doesn't\r\n// in a scenario where we do a lot of fetch() and cancel()\r\n// for example when scrolling quickly through a feed of image\r\n// see: https://hackernoon.com/image-pipeline-with-react-native-listview-b92d4768b17c\r\n  RNFetchBlob.fs.exists(path).then(result => console.log(result));\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/wkh237/react-native-fetch-blob/issues/comments/294300318","html_url":"https://github.com/wkh237/react-native-fetch-blob/issues/331#issuecomment-294300318","issue_url":"https://api.github.com/repos/wkh237/react-native-fetch-blob/issues/331","id":294300318,"user":{"login":"wcandillon","id":306134,"avatar_url":"https://avatars2.githubusercontent.com/u/306134?v=3","gravatar_id":"","url":"https://api.github.com/users/wcandillon","html_url":"https://github.com/wcandillon","followers_url":"https://api.github.com/users/wcandillon/followers","following_url":"https://api.github.com/users/wcandillon/following{/other_user}","gists_url":"https://api.github.com/users/wcandillon/gists{/gist_id}","starred_url":"https://api.github.com/users/wcandillon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wcandillon/subscriptions","organizations_url":"https://api.github.com/users/wcandillon/orgs","repos_url":"https://api.github.com/users/wcandillon/repos","events_url":"https://api.github.com/users/wcandillon/events{/privacy}","received_events_url":"https://api.github.com/users/wcandillon/received_events","type":"User","site_admin":false},"created_at":"2017-04-15T15:31:01Z","updated_at":"2017-04-15T15:31:01Z","body":"@wkh237 Oh right that makes sense. Thank you for the feedback."}}
{"actor":{"display_login":"wcandillon"}}