Skip to content

Commit

Permalink
Merge branch 'misc1'
Browse files Browse the repository at this point in the history
  • Loading branch information
tohutohu committed Aug 21, 2021
2 parents 659cb46 + 851b6e6 commit 6cc6d71
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/webapp/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ func init() {
log.Fatalf("failed to parse ECDSA public key: %v", err)
}

http.DefaultTransport.(*http.Transport).MaxIdleConns = 0 // 無制限
http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = 1024 // 0にすると2になっちゃう
http.DefaultTransport.(*http.Transport).ForceAttemptHTTP2 = true // go1.13以上
}

func main() {
Expand Down Expand Up @@ -258,8 +261,8 @@ func main() {
e.Logger.Fatalf("failed to connect db: %v", err)
return
}
dbShard[i].SetMaxOpenConns(100)
dbShard[i].SetMaxIdleConns(100)
dbShard[i].SetMaxOpenConns(1024)
dbShard[i].SetMaxIdleConns(1024)
defer dbShard[i].Close()
}
db = dbShard[0]
Expand Down Expand Up @@ -1222,7 +1225,7 @@ func updateTrend() (*[]TrendResponse, error) {
// GET /api/trend
// ISUの性格毎の最新のコンディション情報
func getTrend(c echo.Context) error {
time.Sleep(500 * time.Millisecond)
time.Sleep(300 * time.Millisecond)
trendCacheMux.RLock()
res := trendCache
trendCacheMux.RUnlock()
Expand Down

0 comments on commit 6cc6d71

Please sign in to comment.