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

зделяль #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

зделяль #3

wants to merge 2 commits into from

Conversation

bul-nick-al
Copy link

No description provided.

case class FinishOrder(orderId: Int, customer: ActorRef[Customer.Eat.type]) extends Command
case class FinishOrder(orderId: Int, customer: ActorRef[Customer.Eat.type]) extends Command

val random: Random = new Random()
Copy link
Owner

Choose a reason for hiding this comment

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

Опять какой-то глобальный рандом, который шерится между всеми шефами. Можно хотя бы в Behaviors.setup его инициализирвоать

val random: Random = new Random()

def apply(waiter: ActorRef[Waiter.Command], chefConfig: ChefConfig, seed: Long): Behavior[Command] = {
random.setSeed(seed)
Copy link
Owner

Choose a reason for hiding this comment

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

В итоге у рандома будет сид последнего созданного шефа

customerConfig: CustomerConfig,
seed: Long
): Behavior[Command] = {
val random: Random = new Random(seed)
Copy link
Owner

Choose a reason for hiding this comment

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

Вот здесь лучше чем в шефах


def apply(): Behavior[Command] = ???
// Based on the fact that there is only one waiter in the system.
// And also on the fact that I can't no more with all this refactoring ;_;
Copy link
Owner

Choose a reason for hiding this comment

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

а ты через силу

}

object ChefSpec {
val config: ChefConfig = ChefConfig(Boundaries(1, 2))
Copy link
Owner

Choose a reason for hiding this comment

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

иммутабельные вещи запихивать сюда нормально, но всякие инбоксы – нет, они очень мутабельные

Copy link
Owner

Choose a reason for hiding this comment

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

может показаться что в тестах можно говнокодить (и это правда), но конкретно здесь проблема в том, что тест-кейзы могут запускаться отдельно от других кейзов, и тогда будет проблема с консистентностью начального стейта

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.

2 participants