MCPcopy
hub / github.com/tinode/chat / proxyToMasterAsync

Method proxyToMasterAsync

server/cluster.go:397–412  ·  view source on GitHub ↗

proxyToMaster forwards request from topic proxy to topic master.

(msg *ClusterReq)

Source from the content-addressed store, hash-verified

395
396// proxyToMaster forwards request from topic proxy to topic master.
397func (n *ClusterNode) proxyToMasterAsync(msg *ClusterReq) error {
398 select {
399 case n.p2mSender <- msg:
400 return nil
401 default:
402 }
403 // Buffer is full. Wait briefly before giving up.
404 timer := time.NewTimer(clusterP2MTimeout)
405 defer timer.Stop()
406 select {
407 case n.p2mSender <- msg:
408 return nil
409 case <-timer.C:
410 return errors.New("cluster: load exceeded")
411 }
412}
413
414// masterToProxyAsync forwards response from topic master to topic proxy
415// in a fire-and-forget manner.

Callers 2

routeToTopicMasterMethod · 0.80
topicProxyGoneMethod · 0.80

Calls 1

StopMethod · 0.65

Tested by

no test coverage detected