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

RHINENG-14146 Optimize Get Recommendations Query #282

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
FIX: G112: Potential Slowloris Attack
  • Loading branch information
saltgen committed Dec 23, 2024
commit 155dc75d37edc897e137eeec0458562efed84cc0
6 changes: 4 additions & 2 deletions internal/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"net/http"
"time"

"github.com/labstack/echo-contrib/echoprometheus"
"github.com/labstack/echo/v4"
Expand Down Expand Up @@ -53,8 +54,9 @@ func StartAPIServer() {
v1.GET("/recommendations/openshift/:recommendation-id", GetRecommendationSet)

s := http.Server{
Addr: ":" + cfg.API_PORT, //local dev server
Handler: app,
Addr: ":" + cfg.API_PORT, // local dev server
Handler: app,
ReadHeaderTimeout: time.Duration(cfg.ReadHeaderTimeout) * time.Second,
}
if err := s.ListenAndServe(); err != http.ErrServerClosed {
log.Fatal(err)
Expand Down
2 changes: 2 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Config struct {
LogLevel string `mapstructure:"LOG_LEVEL"`
RecommendationPollIntervalHours int `mapstructure:"RECOMMENDATION_POLL_INTERVAL_HOURS"`
DataRetentionPeriod int `mapstructure:"DATA_RETENTION_PERIOD"`
ReadHeaderTimeout int `mapstructure:"READ_HEADER_TIMEOUT"`

// Kafka config
KafkaBootstrapServers string `mapstructure:"KAFKA_BOOTSTRAP_SERVERS"`
Expand Down Expand Up @@ -174,6 +175,7 @@ func initConfig() {
viper.SetDefault("KRUIZE_URL", fmt.Sprintf("http://%s:%s", viper.GetString("KRUIZE_HOST"), viper.GetString("KRUIZE_PORT")))
viper.SetDefault("RECOMMENDATION_POLL_INTERVAL_HOURS", 24)
viper.SetDefault("DATA_RETENTION_PERIOD", 15)
viper.SetDefault("READ_HEADER_TIMEOUT", 15)

// Hack till viper issue get fix - https://github.com/spf13/viper/issues/761
envKeysMap := &map[string]interface{}{}
Expand Down
Loading