Does the GO – RPC have timeout mechanisms?

If RPC does not have a timeout mechanism, if it tries to call the RPC method of a closed server, how to “terminate” the RPC call?
You can use channels to implement timeout mode:

< pre>import “time”

c := make(chan error, 1)
go func() {c <- client.Call("Service", args, &result)} ( )
select {
case err := <-c:
// use err and result
case <-time.After(timeoutNanoseconds):
// call timed out
)

Select will block until client.Call returns or timeoutNanoseconds passes.

If RPC does not have a timeout mechanism, if it does Trying to call the RPC method of a closed server, how to “terminate” the RPC call?

You can use channels to implement timeout mode:

import "time"

c := make(chan error, 1)
go func() {c <- client.Call("Service", args, &result)} ()
select {
case err := <-c:
// use err and result
case <-time.After(timeoutNanoseconds):
// call timed out
}

< p>Select will block until client.Call returns or timeoutNanoseconds passes.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2465 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.