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

add timeout to rpc call #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qlyzpqz
Copy link

@qlyzpqz qlyzpqz commented Sep 7, 2017

#6

为了解决这个issure的问题,给RPC调用增加了一个超时方法,可以将hbs改用一个fake_server来进行测试

package main

import (
"net"
"log"
"time"
)

func serve(conn *net.Conn) {
time.Sleep(time.Duration(1000) * time.Second)
}

func main() {
listener, err := net.Listen("tcp", "0.0.0.0:6030")
if err != nil {
log.Println("[ERROR] listen on :6030 failed,", err)
return
}

for {
	conn, err := listener.Accept()
	if err != nil {
		log.Println("[ERROR] accept an new connection failed,", err)
		break
	}
	go serve(&conn)
}

}

@hitripod
Copy link

移至 open-falcon/falcon-plus#251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants