good morning!!!!
Skip to content
GitLab
Explore
Sign in
Commits on Source (1)
notifier fix maybe
· 01da2a30
a
authored
Feb 28, 2023
01da2a30
Hide whitespace changes
Inline
Side-by-side
handler.go
View file @
01da2a30
...
...
@@ -320,11 +320,11 @@ func (h *handler) handleSubscribe(cp *callProc, r *Request) *Response {
// Install notifier in context so the subscription handler can find it.
n
:=
&
Notifier
{
h
:
h
,
namespace
:
namespace
,
idgen
:
randomIDGenerator
()}
cp
.
notifiers
=
append
(
cp
.
notifiers
,
n
)
req
:=
r
.
WithContext
(
cp
.
ctx
)
// now actually run the handler
req
=
r
eq
.
WithContext
(
context
.
WithValue
(
r
eq
.
ctx
,
notifierKey
{},
n
),
req
:
=
r
.
WithContext
(
context
.
WithValue
(
r
.
ctx
,
notifierKey
{},
n
),
)
mw
=
NewReaderResponseWriterMsg
(
req
)
h
.
reg
.
ServeRPC
(
mw
,
req
)
return
mw
.
Response
()
}
...
...
router_response.go
View file @
01da2a30
...
...
@@ -108,6 +108,9 @@ func (w *ResponseWriterMsg) Send(args any, e error) (err error) {
}
func
(
w
*
ResponseWriterMsg
)
Notify
(
args
any
)
(
err
error
)
{
if
w
.
n
==
nil
{
w
.
n
,
_
=
NotifierFromContext
(
w
.
r
.
ctx
)
}
if
w
.
s
==
nil
||
w
.
n
==
nil
{
return
ErrSubscriptionNotFound
}
...
...