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

refactor(services): add kind and params #13

Merged
merged 3 commits into from
Dec 14, 2018
Merged

refactor(services): add kind and params #13

merged 3 commits into from
Dec 14, 2018

Conversation

FlorentinDUBOIS
Copy link

No description provided.

@FlorentinDUBOIS
Copy link
Author

Closes #8 #9

app/Global.scala Outdated
import play.api.Configuration
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import play.api.{Configuration, _}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just import play.api._ then? (or maybe import only what you actually need)

checks.map(checkToOrder(service))
check.kind match {
case HTTP => {
val params = check.params.getOrElse[Params](HTTPCheckParams(true, "/")) match {
Copy link
Contributor

Choose a reason for hiding this comment

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

The pattern matching is unnecessary here, you already do this with the getOrElse

val buckets = toto.bucketize(orders, 50)
def handleChecks(services: List[CompleteService], tick: Tick) = {
val orders = services.flatMap(service => or.getOrders(service, tick.kind))
val buckets = SchedulerInstances.bucketize(orders, 50)
Copy link
Contributor

Choose a reason for hiding this comment

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

This 50 number worked fine with HTTP only. Now though this should be the interval between each tick for that kind of check, minus a few seconds.

object SchedulerInstances {
Copy link
Contributor

Choose a reason for hiding this comment

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

That name does not make much sense here, I guess the bucketize function should just go in the Scheduler companion object.

.map({ case (s, vs) => CompleteService(s, vs.map(_._2))})
.toList
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why you moved this block? Not that it matters much, it just complicates the diff and makes git blaming a bit harder.

Copy link
Author

Choose a reason for hiding this comment

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

The formatter was excited. I will remove this changes.

@FlorentinDUBOIS FlorentinDUBOIS force-pushed the refactor/service branch 4 times, most recently from f414c38 to 5a43ec5 Compare December 6, 2018 17:12
app/models/Scheduler.scala Outdated Show resolved Hide resolved
@urcadox urcadox merged commit 3c18c2f into master Dec 14, 2018
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