Skip to content

Commit

Permalink
reverted changes to response
Browse files Browse the repository at this point in the history
  • Loading branch information
troygilman committed Aug 19, 2024
1 parent 26b191f commit 069c336
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
5 changes: 1 addition & 4 deletions actor/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ func (e *Engine) Address() string {
// block until the deadline is exceeded or the response is being resolved.
func (e *Engine) Request(pid *PID, msg any, timeout time.Duration) *Response {
resp := NewResponse(e, timeout)
if err := e.Registry.add(resp); err != nil {
resp.err = err
return resp
}
e.Registry.add(resp)

e.SendWithSender(pid, msg, resp.PID())

Expand Down
5 changes: 0 additions & 5 deletions actor/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type Response struct {
pid *PID
result chan any
timeout time.Duration
err error
}

func NewResponse(e *Engine, timeout time.Duration) *Response {
Expand All @@ -33,10 +32,6 @@ func (r *Response) Result() (any, error) {
r.engine.Registry.Remove(r.pid)
}()

if r.err != nil {
return nil, r.err
}

select {
case resp := <-r.result:
return resp, nil
Expand Down

0 comments on commit 069c336

Please sign in to comment.