mirror of
https://github.com/elyby/chrly.git
synced 2025-05-31 14:11:51 +05:30
Implemented health checker for textures provider from Mojang's API
This commit is contained in:
@@ -189,6 +189,7 @@ func newMojangTexturesBatchUUIDsProviderFullBusStrategy(config *viper.Viper) *mo
|
||||
}
|
||||
|
||||
func newMojangTexturesRemoteUUIDsProvider(
|
||||
container *di.Container,
|
||||
config *viper.Viper,
|
||||
emitter mojangtextures.Emitter,
|
||||
) (*mojangtextures.RemoteApiUuidsProvider, error) {
|
||||
@@ -197,6 +198,20 @@ func newMojangTexturesRemoteUUIDsProvider(
|
||||
return nil, fmt.Errorf("unable to parse remote url: %w", err)
|
||||
}
|
||||
|
||||
if err := container.Provide(func(emitter es.Subscriber, config *viper.Viper) *namedHealthChecker {
|
||||
config.SetDefault("healthcheck.mojang_api_textures_provider_cool_down_duration", time.Minute+10*time.Second)
|
||||
|
||||
return &namedHealthChecker{
|
||||
Name: "mojang-api-textures-provider-response-checker",
|
||||
Checker: es.MojangApiTexturesProviderResponseChecker(
|
||||
emitter,
|
||||
config.GetDuration("healthcheck.mojang_api_textures_provider_cool_down_duration"),
|
||||
),
|
||||
}
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &mojangtextures.RemoteApiUuidsProvider{
|
||||
Emitter: emitter,
|
||||
Url: *remoteUrl,
|
||||
|
||||
Reference in New Issue
Block a user