Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Task.gatherUnordered #215

Closed
alexandru opened this Issue Aug 25, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@alexandru
Copy link
Member

alexandru commented Aug 25, 2016

The created Task instance keeps shared state.

    var effect = 0
    val task1 = Task { effect += 1; 3 }.memoize
    val task2 = task1 map { x => effect += 1; x + 1 }
    val task3 = Task.gather(List(task2, task2, task2))

    val result1 = task3.runAsync; s.tick()
    assertEquals(result1.value, Some(Success(List(4,4,4))))
    assertEquals(effect, 1 + 3)

    val result2 = task3.runAsync; s.tick()
    assertEquals(result2.value, Some(Success(List(4,4,4))))
    assertEquals(effect, 1 + 3 + 3)

@alexandru alexandru added the bug label Aug 25, 2016

@alexandru alexandru added this to the 2.0 milestone Aug 25, 2016

@alexandru alexandru self-assigned this Aug 25, 2016

@alexandru alexandru closed this in 49c2f86 Aug 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.