Example #1
0
 public async Task <IActionResult> Schedule(ScheduleClusterAlgorithmCommand command)
 {
     return(await Policy.Handle <ApiException>(ex => ex.StatusCode == HttpStatusCode.InternalServerError)
            .WaitAndRetryAsync(3, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)))
            .ExecuteAsync(async() =>
     {
         var response = await clusterService.Schedule(command);
         return StatusCode((int)response.ResponseMessage.StatusCode);
     }));
 }
Example #2
0
        public async Task <IActionResult> Schedule(ScheduleClusterAlgorithmCommand command)
        {
            if (command.PointsNumber > 1000)
            {
                return(StatusCode(500));
            }

            if (command.PointsNumber < 0)
            {
                return(BadRequest());
            }

            return(Ok());
        }