调整框架的超时为 15秒

This commit is contained in:
eson 2023-07-12 10:22:03 +08:00
parent a4f429a528
commit 55eabd5cae
20 changed files with 47 additions and 14 deletions

View File

@ -13,7 +13,8 @@ func main() {
flag.Parse() flag.Parse()
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -13,7 +13,8 @@ func main() {
flag.Parse() flag.Parse()
var c gateway.GatewayConf var c gateway.GatewayConf
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
gw := gateway.MustNewServer(c) gw := gateway.MustNewServer(c)
defer gw.Stop() defer gw.Stop()
gw.Start() gw.Start()

View File

@ -19,7 +19,8 @@ func main() {
flag.Parse() flag.Parse()
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
ctx := svc.NewServiceContext(c) ctx := svc.NewServiceContext(c)
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {

View File

@ -13,7 +13,8 @@ func main() {
flag.Parse() flag.Parse()
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -13,7 +13,8 @@ func main() {
flag.Parse() flag.Parse()
var c gateway.GatewayConf var c gateway.GatewayConf
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
gw := gateway.MustNewServer(c) gw := gateway.MustNewServer(c)
defer gw.Stop() defer gw.Stop()
gw.Start() gw.Start()

View File

@ -19,7 +19,8 @@ func main() {
flag.Parse() flag.Parse()
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
ctx := svc.NewServiceContext(c) ctx := svc.NewServiceContext(c)
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {

View File

@ -1,7 +1,6 @@
package main package main
import ( import (
"fmt"
"testing" "testing"
) )
@ -9,10 +8,10 @@ func TestProxy(t *testing.T) {
main() main()
} }
func TestCapture(t *testing.T) { // func TestCapture(t *testing.T) {
rootDir := "../server" // Change this to your root directory // rootDir := "../server" // Change this to your root directory
results := GetZeroInfo(rootDir) // results := GetZeroInfo(rootDir)
for _, result := range results { // for _, result := range results {
fmt.Printf("FolderName: %s, Host: %s, Port: %d, PrefixRoute: %v\n", result.FolderName, result.Host, result.Port, result.PrefixRoute) // fmt.Printf("FolderName: %s, Host: %s, Port: %d, PrefixRoute: %v\n", result.FolderName, result.Host, result.Port, result.PrefixRoute)
} // }
} // }

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/backend/internal/config" "fusenapi/server/backend/internal/config"
"fusenapi/server/backend/internal/handler" "fusenapi/server/backend/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/canteen/internal/config" "fusenapi/server/canteen/internal/config"
"fusenapi/server/canteen/internal/handler" "fusenapi/server/canteen/internal/handler"
@ -20,7 +21,10 @@ func main() {
flag.Parse() flag.Parse()
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -8,6 +8,7 @@ import (
svc2 "fusenapi/server/data-transfer/internal/svc" svc2 "fusenapi/server/data-transfer/internal/svc"
"fusenapi/utils/auth" "fusenapi/utils/auth"
"net/http" "net/http"
"time"
"github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/rest" "github.com/zeromicro/go-zero/rest"
@ -20,6 +21,7 @@ func main() {
var c config2.Config var c config2.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/home-user-auth/internal/config" "fusenapi/server/home-user-auth/internal/config"
"fusenapi/server/home-user-auth/internal/handler" "fusenapi/server/home-user-auth/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/inventory/internal/config" "fusenapi/server/inventory/internal/config"
"fusenapi/server/inventory/internal/handler" "fusenapi/server/inventory/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/map-library/internal/config" "fusenapi/server/map-library/internal/config"
"fusenapi/server/map-library/internal/handler" "fusenapi/server/map-library/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/orders/internal/config" "fusenapi/server/orders/internal/config"
"fusenapi/server/orders/internal/handler" "fusenapi/server/orders/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/product-model/internal/config" "fusenapi/server/product-model/internal/config"
"fusenapi/server/product-model/internal/handler" "fusenapi/server/product-model/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/product-template/internal/config" "fusenapi/server/product-template/internal/config"
"fusenapi/server/product-template/internal/handler" "fusenapi/server/product-template/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/product/internal/config" "fusenapi/server/product/internal/config"
"fusenapi/server/product/internal/handler" "fusenapi/server/product/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/shopping-cart-confirmation/internal/config" "fusenapi/server/shopping-cart-confirmation/internal/config"
"fusenapi/server/shopping-cart-confirmation/internal/handler" "fusenapi/server/shopping-cart-confirmation/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/upload/internal/config" "fusenapi/server/upload/internal/config"
"fusenapi/server/upload/internal/handler" "fusenapi/server/upload/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"time"
"fusenapi/server/webset/internal/config" "fusenapi/server/webset/internal/config"
"fusenapi/server/webset/internal/handler" "fusenapi/server/webset/internal/handler"
@ -21,6 +22,7 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
c.Timeout = int64(time.Second * 15)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {