{"action":"closed","issue":{"url":"https://api.github.com/repos/lodash/lodash/issues/4049","repository_url":"https://api.github.com/repos/lodash/lodash","labels_url":"https://api.github.com/repos/lodash/lodash/issues/4049/labels{/name}","comments_url":"https://api.github.com/repos/lodash/lodash/issues/4049/comments","events_url":"https://api.github.com/repos/lodash/lodash/issues/4049/events","html_url":"https://github.com/lodash/lodash/issues/4049","id":378706987,"node_id":"MDU6SXNzdWUzNzg3MDY5ODc=","number":4049,"title":"Is there a function could prevent a function be processed twice at same time?","user":{"login":"cnwangjie","id":7459652,"node_id":"MDQ6VXNlcjc0NTk2NTI=","avatar_url":"https://avatars3.githubusercontent.com/u/7459652?v=4","gravatar_id":"","url":"https://api.github.com/users/cnwangjie","html_url":"https://github.com/cnwangjie","followers_url":"https://api.github.com/users/cnwangjie/followers","following_url":"https://api.github.com/users/cnwangjie/following{/other_user}","gists_url":"https://api.github.com/users/cnwangjie/gists{/gist_id}","starred_url":"https://api.github.com/users/cnwangjie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnwangjie/subscriptions","organizations_url":"https://api.github.com/users/cnwangjie/orgs","repos_url":"https://api.github.com/users/cnwangjie/repos","events_url":"https://api.github.com/users/cnwangjie/events{/privacy}","received_events_url":"https://api.github.com/users/cnwangjie/received_events","type":"User","site_admin":false},"labels":[{"id":2763156,"node_id":"MDU6TGFiZWwyNzYzMTU2","url":"https://api.github.com/repos/lodash/lodash/labels/question","name":"question","color":"d4c5f9","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-08T12:18:51Z","updated_at":"2018-11-08T16:02:56Z","closed_at":"2018-11-08T16:02:56Z","author_association":"NONE","body":"Sometimes I don't want a function could be processed again if it is processing, so I need to add a flag to indicate it is processing and set it as false after the function is finished. Similar to the effect of the following code. \r\n\r\n\r\n```js\r\n\r\nlet _processing = false\r\n\r\nconst doSth = async () => {\r\n\tif (_processing) return\r\n\t_processing = true\r\n\ttry {\r\n\t\t// some task that may spend a lot of time ...\r\n\t} catch (e) {\r\n\t\tthrow e\r\n\t} finally {\r\n\t\t_processing = false\r\n\t}\r\n}\r\n\r\n```\r\n\r\nI think it is a common need to control function likes `debounce` & `throttle`. Is there already a library that implements this feature? Or is it worth adding one such method to lodash?"}}
{"actor":{"display_login":"jdalton"}}