Skip to content

Commit

Permalink
Fix: make getLatestDeployment a public at PeriodicProcessService (#4284)
Browse files Browse the repository at this point in the history
Co-authored-by: Łukasz Ciołecki <[email protected]>
  • Loading branch information
lciolecki and Łukasz Ciołecki authored May 11, 2023
1 parent 55e2ada commit efb7e3c
Showing 1 changed file with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,21 +350,22 @@ class PeriodicProcessService(delegateDeploymentManager: DeploymentManager,
}
}


/**
* Returns latest deployment. It can be in any status (consult [[PeriodicProcessDeploymentStatus]]).
* For multiple schedules only single schedule is returned in the following order:
* <ol>
* <li>If there are any deployed scenarios, then the first one is returned. Please be aware that deployment of previous
* schedule could fail.</li>
* <li>If there are any failed scenarios, then the last one is returned. We want to inform user, that some deployments
* failed and the scenario should be rescheduled/retried manually.
* <li>If there are any scheduled scenarios, then the first one to be run is returned.
* <li>If there are any finished scenarios, then the last one is returned. It should not happen because the scenario
* should be deactivated earlier.
* </ol>
*/
private[periodic] def getLatestDeployment(processName: ProcessName): Future[Option[PeriodicProcessDeployment]] = {
* @Important: this method has to be public because it can be used by dedicated process manager
*
* Returns latest deployment. It can be in any status (consult [[PeriodicProcessDeploymentStatus]]).
* For multiple schedules only single schedule is returned in the following order:
* <ol>
* <li>If there are any deployed scenarios, then the first one is returned. Please be aware that deployment of previous
* schedule could fail.</li>
* <li>If there are any failed scenarios, then the last one is returned. We want to inform user, that some deployments
* failed and the scenario should be rescheduled/retried manually.
* <li>If there are any scheduled scenarios, then the first one to be run is returned.
* <li>If there are any finished scenarios, then the last one is returned. It should not happen because the scenario
* should be deactivated earlier.
* </ol>
*/
def getLatestDeployment(processName: ProcessName): Future[Option[PeriodicProcessDeployment]] = {
scheduledProcessesRepository.getLatestDeploymentForEachSchedule(processName)
.map(_.sortBy(_.runAt)).run
.map { deployments =>
Expand All @@ -383,4 +384,4 @@ class PeriodicProcessService(delegateDeploymentManager: DeploymentManager,
}
}

}
}

0 comments on commit efb7e3c

Please sign in to comment.