{"action":"opened","issue":{"url":"https://api.github.com/repos/r-simmer/simmer/issues/93","repository_url":"https://api.github.com/repos/r-simmer/simmer","labels_url":"https://api.github.com/repos/r-simmer/simmer/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/r-simmer/simmer/issues/93/comments","events_url":"https://api.github.com/repos/r-simmer/simmer/issues/93/events","html_url":"https://github.com/r-simmer/simmer/issues/93","id":226518083,"number":93,"title":"Dynamic timeout for batches","user":{"login":"Enchufa2","id":4542928,"avatar_url":"https://avatars2.githubusercontent.com/u/4542928?v=3","gravatar_id":"","url":"https://api.github.com/users/Enchufa2","html_url":"https://github.com/Enchufa2","followers_url":"https://api.github.com/users/Enchufa2/followers","following_url":"https://api.github.com/users/Enchufa2/following{/other_user}","gists_url":"https://api.github.com/users/Enchufa2/gists{/gist_id}","starred_url":"https://api.github.com/users/Enchufa2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Enchufa2/subscriptions","organizations_url":"https://api.github.com/users/Enchufa2/orgs","repos_url":"https://api.github.com/users/Enchufa2/repos","events_url":"https://api.github.com/users/Enchufa2/events{/privacy}","received_events_url":"https://api.github.com/users/Enchufa2/received_events","type":"User","site_admin":false},"labels":[{"id":124371632,"url":"https://api.github.com/repos/r-simmer/simmer/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-05T09:24:49Z","updated_at":"2017-05-05T09:24:49Z","closed_at":null,"body":"Related to [this thread](https://groups.google.com/d/msg/simmer-devel/9wCyocdRSag/sscGiQSaAwAJ).\r\n\r\nInstead of this,\r\n\r\n```r\r\ntriage <- trajectory(\"Patient's path\") %>%\r\n  log_(\"arrive at queue\") %>%\r\n  trap(\"check mailbox\") %>%\r\n  wait() %>%\r\n  log_(\"triage\")\r\n\r\nmailbox <- trajectory() %>%\r\n  timeout(function() rgamma(1, shape = 2, rate = 0.1)) %>%\r\n  send(\"check mailbox\") %>%\r\n  rollback(2, Inf)\r\n\r\nset.seed(1234)\r\n\r\nenv <- simmer()  %>%\r\n  add_generator(\"person\", triage, function() rpois(1, 2)) %>%\r\n  add_generator(\"mailbox\", mailbox, at(0)) %>%\r\n  run(25)\r\n```\r\n\r\naccepting a function in a `batch()`'s `timeout` parameter  would allow us to do the following (not working yet):\r\n\r\n```r\r\ntriage <- trajectory(\"Patient's path\") %>%\r\n  log_(\"arrive at queue\") %>%\r\n  batch(Inf, timeout=function() rgamma(1, shape = 2, rate = 0.1)) %>%\r\n  separate() %>%\r\n  log_(\"triage\")\r\n\r\nset.seed(1234)\r\n\r\nenv <- simmer()  %>%\r\n  add_generator(\"person\", triage, function() rpois(1, 2)) %>%\r\n  run(25)\r\n```\r\n\r\nSupport for `n=Inf` would be needed too."}}
{"actor":{"display_login":"Enchufa2"}}