Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

I believe we should be checking if both queues have been shutdown here.

@adamgfraser adamgfraser requested a review from jdegoes January 31, 2021 14:15
def size: UIO[Int] = self.size.zipWithPar(that.size)(math.max)
def shutdown: UIO[Unit] = self.shutdown.zipWithPar(that.shutdown)((_, _) => ())
def isShutdown: UIO[Boolean] = self.isShutdown
def isShutdown: UIO[Boolean] = self.isShutdown.zipWithPar(that.isShutdown)(_ && _)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually should this be && or ||? You're going to get interrupted if you try to pull from a composite queue if either queue has been shutdown, so in that sense || seems like the wrong semantics. But on the other hand shutdown of the composite queue hasn't been completed until both queues have been shut down.

@adamgfraser adamgfraser requested a review from iravid February 3, 2021 03:45
@adamgfraser
Copy link
Contributor Author

@jdegoes Do you have a sense of what the right semantics are here or should we just close this since these operators are deprecated anyway?

@jdegoes
Copy link
Member

jdegoes commented Feb 18, 2021

@adamgfraser isShutdown should reflect the following: if a putter or taker will be interrupted when attempting to put or take, then the queue should be regarded as shut down. Otherwise, not.

@adamgfraser
Copy link
Contributor Author

Okay, then I think reporting that the combined queue is shutdown if either of the original queues is shut down is the correct semantic. Updated to reflect that now.

@adamgfraser adamgfraser merged commit 409c504 into zio:master Feb 27, 2021
@adamgfraser adamgfraser deleted the queue branch February 27, 2021 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants