{"action":"created","issue":{"url":"https://api.github.com/repos/ubolonton/js-csp/issues/110","repository_url":"https://api.github.com/repos/ubolonton/js-csp","labels_url":"https://api.github.com/repos/ubolonton/js-csp/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/ubolonton/js-csp/issues/110/comments","events_url":"https://api.github.com/repos/ubolonton/js-csp/issues/110/events","html_url":"https://github.com/ubolonton/js-csp/issues/110","id":198252090,"number":110,"title":"timers cleanup","user":{"login":"gt3","id":1564233,"avatar_url":"https://avatars.githubusercontent.com/u/1564233?v=3","gravatar_id":"","url":"https://api.github.com/users/gt3","html_url":"https://github.com/gt3","followers_url":"https://api.github.com/users/gt3/followers","following_url":"https://api.github.com/users/gt3/following{/other_user}","gists_url":"https://api.github.com/users/gt3/gists{/gist_id}","starred_url":"https://api.github.com/users/gt3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gt3/subscriptions","organizations_url":"https://api.github.com/users/gt3/orgs","repos_url":"https://api.github.com/users/gt3/repos","events_url":"https://api.github.com/users/gt3/events{/privacy}","received_events_url":"https://api.github.com/users/gt3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-01-01T00:33:37Z","updated_at":"2017-01-01T17:41:13Z","closed_at":null,"body":"Current implementation of Timers (with setTimeout) keeps the host process running for the specified delay.\r\n```\r\ncsp.timeout(ms)\r\n```\r\n[_**alts**_](https://github.com/ubolonton/js-csp/blob/master/doc/basic.md#yield-altsoperations-options)  - To reproduce, use this example from the docs. Run in Node repl.\r\n\r\nAnd here's is my proposal to fix it without breaking changes:\r\n1. Keep track of the timer along with the returned channel (in timeout)\r\n2. Use the timer handle to call clearTimeout on channel close\r\n\r\nThere is one caveat with this approach. It introduces a new constraint on the system: Channels returned from timeout should be reserved for timeout, except now you can explicitly close it, which will eventually release timers.\r\n\r\nNode timers have ref/unref which I'll investigate further. However clearTimeout seems to be more fitting and universal.\r\n\r\nthoughts? .. @ubolonton @hung-phan \r\n"},"comment":{"url":"https://api.github.com/repos/ubolonton/js-csp/issues/comments/269912025","html_url":"https://github.com/ubolonton/js-csp/issues/110#issuecomment-269912025","issue_url":"https://api.github.com/repos/ubolonton/js-csp/issues/110","id":269912025,"user":{"login":"gt3","id":1564233,"avatar_url":"https://avatars.githubusercontent.com/u/1564233?v=3","gravatar_id":"","url":"https://api.github.com/users/gt3","html_url":"https://github.com/gt3","followers_url":"https://api.github.com/users/gt3/followers","following_url":"https://api.github.com/users/gt3/following{/other_user}","gists_url":"https://api.github.com/users/gt3/gists{/gist_id}","starred_url":"https://api.github.com/users/gt3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gt3/subscriptions","organizations_url":"https://api.github.com/users/gt3/orgs","repos_url":"https://api.github.com/users/gt3/repos","events_url":"https://api.github.com/users/gt3/events{/privacy}","received_events_url":"https://api.github.com/users/gt3/received_events","type":"User","site_admin":false},"created_at":"2017-01-01T17:41:13Z","updated_at":"2017-01-01T17:41:13Z","body":"@hung-phan I've created a gist to demonstrate my point but I think you get the idea. If we are closing the channel why not clear the timeout?\r\n\r\nI am not sure why it isn't handled in cljs. In the link you've described timer handle is returned from queue-delay but that's the only difference I could find.\r\nhttps://github.com/clojure/core.async/blob/f8e87e1625b1660b7f3b0aea044aad1327441741/src/main/clojure/cljs/core/async/impl/timers.cljs#L152"}}
{"actor":{"display_login":"gt3"}}