func New(initCtx context.Context, c *ServerConf, l *logger.Logger) (*Server, error) {
	ln, err := net.Listen("tcp", fmt.Sprintf(":%d", int(c.GetPort())))
	if err != nil {
		return nil, err
	}

	// If we are not able get the default lameduck lister, we only log a warning.
	ldLister, err := lameduck.GetDefaultLister()
	if err != nil {
		l.Warning(err)
	}

	// Cleanup listener if initCtx is canceled.
	go func() {
		<-initCtx.Done()
		ln.Close()
	}()

	return &Server{
		c:             c,
		l:             l,
		ln:            ln,
		ldLister:      ldLister,
		statsInterval: statsExportInterval,
		instanceName:  sysvars.Vars()["instance"],
		staticURLResTable: map[string]string{
			"/":         OK,
			"/instance": sysvars.Vars()["instance"],
		},
	}, nil
}
// New returns a Server.
New returns a Server.
// New returns a Server .
func New(initCtx context.Context, c *ServerConf, l *logger.Logger) (*Server, error) {
	ln, err := net.Listen("tcp", fmt.Sprintf(":%d", int(c.GetPort())))
	if err != nil {
		return nil, err
	}
	ldLister, err := lameduck.GetDefaultLister()
	if err != nil {
		l.Warning(err)
	}
	go func() {
		<-initCtx.Done()
		ln.Close()
	}()
	return &Server{
		c:             c,
		l:             l,
		ln:            ln,
		ldLister:      ldLister,
		statsInterval: statsExportInterval,
		instanceName:  sysvars.Vars()["instance"],
		staticURLResTable: map[string]string{
			"/":         OK,
			"/instance": sysvars.Vars()["instance"],
		},
	}, nil
}
func New ( initCtx context . Context , c * ServerConf , l * logger . Logger ) ( * Server , error ) { ln , err := net . Listen ( " " , fmt . Sprintf ( " " , int ( c . GetPort ( ) ) ) ) if err != nil { return nil , err } ldLister , err := lameduck . GetDefaultLister ( ) if err != nil { l . Warning ( err ) } go func ( ) { <- initCtx . Done ( ) ln . Close ( ) } ( ) return & Server { c : c , l : l , ln : ln , ldLister : ldLister , statsInterval : statsExportInterval , instanceName : sysvars . Vars ( ) [ " " ] , staticURLResTable : map [ string ] string { " " : OK , " " : sysvars . Vars ( ) [ " " ] , } , } , nil }
New returns a Server.
New returns a Server .
// If we are not able get the default lameduck lister, we only log a warning. // Cleanup listener if initCtx is canceled.