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

Fetch status of all scenarios in DM in a single operation instead of separately for each scenario. #7295

Merged
merged 22 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
qs
mgoworko committed Dec 18, 2024
commit 55ff8daef6dcf3219d1aa81a04c5b2c5988abf61
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@ import slick.jdbc
import slick.jdbc.JdbcProfile

import java.time.{Clock, Instant}
import scala.concurrent.duration.FiniteDuration
import scala.concurrent.{ExecutionContext, Future}

object PeriodicDeploymentManager {
@@ -275,20 +274,17 @@ class PeriodicDeploymentManager private[periodic] (
}

// TODO: Why we don't allow running not scheduled scenario? Maybe we can try to schedule it?
private def instantSchedule(processName: ProcessName): OptionT[Future, Unit] = {
implicit val freshnessPolicy: DataFreshnessPolicy = DataFreshnessPolicy.Fresh
for {
// schedule for immediate run
processDeployment <- OptionT(
service
.getLatestDeploymentsForActiveSchedules(processName)
.map(_.groupedByPeriodicProcess.headOption.flatMap(_.deployments.headOption))
)
processDeploymentWithProcessJson <- OptionT.liftF(
repository.findProcessData(processDeployment.id).run
)
_ <- OptionT.liftF(service.deploy(processDeploymentWithProcessJson))
} yield ()
}
private def instantSchedule(processName: ProcessName): OptionT[Future, Unit] = for {
// schedule for immediate run
processDeployment <- OptionT(
service
.getLatestDeploymentsForActiveSchedules(processName)
.map(_.groupedByPeriodicProcess.headOption.flatMap(_.deployments.headOption))
)
processDeploymentWithProcessJson <- OptionT.liftF(
repository.findProcessData(processDeployment.id).run
)
_ <- OptionT.liftF(service.deploy(processDeploymentWithProcessJson))
} yield ()

}