replace default go resolver with caching resolver

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-12-03 01:11:08 +03:00
parent 36b7b9f5fb
commit bf4143cde5
5 changed files with 581 additions and 5 deletions

View File

@@ -3,7 +3,9 @@ package micro
import (
"fmt"
"net"
"sync"
"time"
"github.com/KimMachineGun/automemlimit/memlimit"
"go.uber.org/automaxprocs/maxprocs"
@@ -17,6 +19,7 @@ import (
"go.unistack.org/micro/v3/server"
"go.unistack.org/micro/v3/store"
"go.unistack.org/micro/v3/tracer"
utildns "go.unistack.org/micro/v3/util/dns"
)
func init() {
@@ -30,6 +33,8 @@ func init() {
),
),
)
net.DefaultResolver = utildns.NewNetResolver(utildns.Timeout(1 * time.Second))
}
// Service is an interface that wraps the lower level components.