question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Riddle number 6 does not check for parallelism

See original GitHub issue

Hey,

There is a small problem with riddle number 6 and it is up to you guys how you want to solve it. In the task description there is mentioned that

Execute both [first] and [second] Single’s in parallel…

however you solution works sequentially. Thats because there are no schedulers running on mentioned Singles which means everything executes on main thread. Test is passing because it is not really checking for parallelism. If you would want to do that you could

val first = Single.timer(5, SECONDS, rxRule)
        .map { 10 }
        .doOnSubscribe { subscribeCounter.incrementAndGet() }

val second = Single.timer(3, SECONDS, rxRule)
        .map { 5 }
        .doOnSubscribe { subscribeCounter.incrementAndGet() }

// rest of the test goes here...

rxRule.advanceTimeBy(4, SECONDS)

// check if second already finished and the first one did not
first.test().assertNotComplete()
second.test().assertComplete()

You get the idea. So if the intention was to check for parallelism you need to adjust solution. If solution is good then you need to adjust the description.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vanniktechcommented, May 28, 2018

I don’t quite understand the problem.

RxRule is having a Scheduler that will run. The essential part is that subscribe is called eagerly. Which is asserted with assertEmpty() & assertThat(subscribeCounter.get()).isEqualTo(2) // We want to subscribe immediately.

0reactions
lwasylcommented, Jan 12, 2019

@vanniktech took me a while to find time for this, here is my suggestion. I believe not providing a scheduler and not changing the comment is the way to go for this to still be a riddle 😉 Let me know what you think

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parallelism (Page 1) / Help Me ! / Math Is Fun Forum
I just need help with checking these if they're right. ... D no. E yes. F none of the above. 4. If angle...
Read more >
Sentence Parallel Structure - Exercise 2 - Towson University
Revise each sentence so that the elements joined by the coordinate conjunction are parallel to one another. Write your answers in the space...
Read more >
The Passcode Riddle: A Parallel Example in R
Summary: The passcode riddle asks for three three whole positive numbers with each one being equal to or larger than the next.
Read more >
Aristotle's Number Puzzle | Mastering Parallel Programming ...
The puzzle we will solve is known as Aristotle's Number Puzzle, ... For a partial line, a check is made to ensure that...
Read more >
Situation Puzzles Answers - Jed Hartman
1.1 answer: The man was in a ship that was wrecked on a desert island. When there was no food left, another passenger...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found