Skip to content

synchronize() not work as expected #275

@vohai611

Description

@vohai611
library(simmer)
end = trajectory() %>% 
  synchronize(wait = FALSE) %>% 
  log_('leave')

p = trajectory() %>% 
  clone(n = 2,
        trajectory() %>% renege_in(t = 1, out = trajectory() %>% 
                                     join(end) ) %>% timeout(5) ,
        trajectory() %>% timeout(3) %>%
          join(end)) 

simmer() %>% 
  add_generator("p", p, distribution = at(c(1))) %>% 
  run(until = 10)
#> 2: p0: leave
#> 4: p0: leave
#> simmer environment: anonymous | now: 4 | next: 
#> { Monitor: in memory }
#> { Source: p | monitored: 1 | n_generated: 1 }

Created on 2022-03-04 by the reprex package (v2.0.1)

I expect that with wait=FALSE, only the first arrival can reach log_("leave").
Anyway, thank you guys for an amazing pacakges!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions