|
@@ -69,18 +69,21 @@ func (m *MailBox) setBusyStat(stat int32) {
|
|
|
}
|
|
|
|
|
|
func (m *MailBox) tryInit(attempt int) {
|
|
|
- server.Log.Debugf("Try to init actor, attempt %d", attempt)
|
|
|
+ server.Log.Errorf("Try to init actor, attempt %d", attempt)
|
|
|
err := m.actor.Init(m)
|
|
|
if err != nil {
|
|
|
server.Log.Errorf("failed to init actor, err :%s, attempt %d", err.Error(), attempt)
|
|
|
attempt += 1
|
|
|
if attempt > 10 {
|
|
|
_ = m.system.StopActorById(m.id)
|
|
|
+ server.Log.Errorf("StopActorById:%s", m.id)
|
|
|
+ return
|
|
|
}
|
|
|
_ = m.dispatcher.Submit(func() {
|
|
|
m.tryInit(attempt)
|
|
|
})
|
|
|
}
|
|
|
+ server.Log.Errorf("init success")
|
|
|
m.setReadyStat(READY)
|
|
|
m.setBusyStat(FREE)
|
|
|
m.tryProcessQueue(false)
|
|
@@ -168,6 +171,9 @@ func (m *MailBox) Tell(msg protocol.ActorMsg) {
|
|
|
|
|
|
// push a message to queue
|
|
|
func (m *MailBox) enqueue(msg protocol.ActorMsg, isHighPriority bool) {
|
|
|
+ if m.getBusyStat() != READY {
|
|
|
+ return
|
|
|
+ }
|
|
|
if isHighPriority {
|
|
|
m.highPriorityMessages.Push(msg)
|
|
|
} else {
|