Skip to content

Commit

Permalink
weird
Browse files Browse the repository at this point in the history
  • Loading branch information
perbu committed Dec 6, 2023
1 parent 1993ba3 commit c93d7e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions actor/deadletter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ func TestDeadLetterCustom(t *testing.T) {
assert.Nil(t, err) // no error from the request
assert.NotNil(t, resp) // we should get a response to our request
respDeadLetters, ok := resp.([]DeadLetterEvent)
assert.True(t, ok) // got a slice of deadletter events
assert.True(t, ok) // got a slice of deadletter events
return
assert.Equal(t, 1, len(respDeadLetters)) // one deadletter event
ev, ok := respDeadLetters[0].Message.(testMessage)
assert.True(t, ok) // should be our test message
Expand Down Expand Up @@ -107,7 +108,7 @@ func (c *customDeadLetter) Receive(ctx *Context) {
switch ctx.Message().(type) {
case Started:
slog.Debug("custom deadletter starting", "action", "subscribing")
ctx.engine.BroadcastEvent(DeadletterSub{pid: ctx.pid})
ctx.Engine().BroadcastEvent(DeadletterSub{pid: ctx.pid})
time.Sleep(time.Millisecond * 10)
case Stopped:
slog.Debug("custom deadletter stopping", "action", "unsubscribing")
Expand Down
3 changes: 3 additions & 0 deletions actor/engine.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package actor

import (
"fmt"
"sync"
"time"
)
Expand Down Expand Up @@ -153,6 +154,8 @@ func (e *Engine) Send(pid *PID, msg any) {
func (e *Engine) BroadcastEvent(msg any) {
if e.eventStream != nil {
e.send(e.eventStream, msg, nil)
} else {
fmt.Println("Brain damage: event stream is nil")
}
}

Expand Down

0 comments on commit c93d7e9

Please sign in to comment.