mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Use json in healthcheck
This commit is contained in:
parent
8cf105a550
commit
d0db4815f1
7
.github/workflows/robot.yml
vendored
7
.github/workflows/robot.yml
vendored
@ -30,7 +30,12 @@ jobs:
|
||||
|
||||
- name: Start the service
|
||||
run: |
|
||||
docker-compose up -d --wait
|
||||
docker-compose up -d # --wait Wait is not available on gha
|
||||
|
||||
- name: Perform healthchecks
|
||||
run: |
|
||||
docker-compose ps -a
|
||||
wget --retry-connrefused --retry-on-http-error=502 http://localhost:8901/api/health
|
||||
|
||||
- name: Run robot tests
|
||||
run: |
|
||||
|
@ -48,7 +48,7 @@ namespace Kyoo.Core.Api
|
||||
/// </summary>
|
||||
/// <returns>A status indicating the health of the api.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
||||
public async Task<IActionResult> CheckHealth()
|
||||
{
|
||||
@ -60,11 +60,16 @@ namespace Kyoo.Core.Api
|
||||
HealthReport result = await _healthCheckService.CheckHealthAsync();
|
||||
return result.Status switch
|
||||
{
|
||||
HealthStatus.Healthy => NoContent(),
|
||||
HealthStatus.Unhealthy => NoContent(),
|
||||
HealthStatus.Healthy => Ok(new HealthResult("Healthy")),
|
||||
HealthStatus.Unhealthy => Ok(new HealthResult("Unstable")),
|
||||
HealthStatus.Degraded => StatusCode(StatusCodes.Status503ServiceUnavailable),
|
||||
_ => StatusCode(StatusCodes.Status500InternalServerError),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The result of a health operation.
|
||||
/// </summary>
|
||||
public record HealthResult(string Status);
|
||||
}
|
||||
}
|
||||
|
@ -2,24 +2,24 @@ from enum import Enum
|
||||
|
||||
|
||||
class Genre(str, Enum):
|
||||
ACTION = "action"
|
||||
ADVENTURE = "adventure"
|
||||
ANIMATION = "animation"
|
||||
COMEDY = "comedy"
|
||||
CRIME = "crime"
|
||||
DOCUMENTARY = "documentary"
|
||||
DRAMA = "drama"
|
||||
FAMILY = "family"
|
||||
FANTASY = "fantasy"
|
||||
HISTORY = "history"
|
||||
HORROR = "horror"
|
||||
MUSIC = "music"
|
||||
MYSTERY = "mystery"
|
||||
ROMANCE = "romance"
|
||||
SCIENCE_FICTION = "scienceFiction"
|
||||
THRILLER = "thriller"
|
||||
WAR = "war"
|
||||
WESTERN = "western"
|
||||
ACTION = "Action"
|
||||
ADVENTURE = "Adventure"
|
||||
ANIMATION = "Animation"
|
||||
COMEDY = "Comedy"
|
||||
CRIME = "Crime"
|
||||
DOCUMENTARY = "Documentary"
|
||||
DRAMA = "Drama"
|
||||
FAMILY = "Family"
|
||||
FANTASY = "Fantasy"
|
||||
HISTORY = "History"
|
||||
HORROR = "Horror"
|
||||
MUSIC = "Music"
|
||||
MYSTERY = "Mystery"
|
||||
ROMANCE = "Romance"
|
||||
SCIENCE_FICTION = "Science Fiction"
|
||||
THRILLER = "Thriller"
|
||||
WAR = "War"
|
||||
WESTERN = "Western"
|
||||
|
||||
def to_kyoo(self):
|
||||
return {"name": self}
|
||||
return {"name": f"{self}"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user