Is there a limit to the Goroutine that calls gen.ServerProcess.CallWithTimeout (...)? #132
-
HandleCast(process *ServerProcess, message etf.Term) ServerStatus
HandleCall(process *ServerProcess, from ServerFrom, message etf.Term) (etf.Term, ServerStatus)
HandleDirect(process *ServerProcess, ref etf.Ref, message interface{}) (interface{}, DirectStatus)
HandleInfo(process *ServerProcess, message etf.Term) ServerStatus Otherwise, ProcessLoop will be blocked : func (sp *ServerProcess) waitCallbackOrDeferr(message interface{}) {
...
select {
//case <-sp.Context().Done():
// do not read the context state. otherwise the goroutine with running callback
// might lock forever on exit (or on making a Call request) as nobody read
// the callbackWaitReply channel.
case sp.waitReply = <-sp.callbackWaitReply:
// not nil value means callback made a Call request and waiting for reply
if sp.waitReply == nil && len(sp.deferred) > 0 {
sp.mailbox = sp.deferred
}
return
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Call*/Cast methods can be used inside gen.ServerProcess only (within Handle* callbacks only, to be specific). If you need to make a sync call to the process being outside of the actor, you should use gen.Process.Direct or gen.Process.DirectWithTimeout or gen.Process.Send for async messaging |
Beta Was this translation helpful? Give feedback.
-
btw, here is auto-translation of the documentation for the gen.Process https://ru-docs-ergo-services.translate.goog/basics/process?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp. Its still a draft, but hope it will help you to understand some details. |
Beta Was this translation helpful? Give feedback.
Call*/Cast methods can be used inside gen.ServerProcess only (within Handle* callbacks only, to be specific). If you need to make a sync call to the process being outside of the actor, you should use gen.Process.Direct or gen.Process.DirectWithTimeout or gen.Process.Send for async messaging