File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -337,7 +337,7 @@ Note that `client.Receive()` doesn't unsubscribe channels automatically when it
337337``` go
338338ctx , cancel := context.WithCancel (context.Background ())
339339
340- ctx = rueidis.WithOnReceiveReturnHook (context. Background () , func (err error , client rueidis.CommandClient ) error {
340+ ctx = rueidis.WithOnReceiveReturnHook (ctx , func (err error , client rueidis.CommandClient ) error {
341341 if errors.Is (err, context.Canceled ) {
342342 // Send UNSUBSCRIBE command to the connection
343343 return client.Do (context.Background (), client.B ().Unsubscribe ().Channel (" news" ).Build ()).Error ()
@@ -641,7 +641,7 @@ If an incorrect parser function is chosen, an errParse will be returned. Here's
641641// Attempt to parse the response. If a parsing error occurs, check if the error is a parse error and handle it.
642642// Normally, you should fix the code by choosing the correct parser function.
643643// For instance, use ToString() if the expected response is a string, or ToArray() if the expected response is an array as follows:
644- if err := client.Do (ctx, client.B ().Get ().Key (" k" ).Build ()).ToArray (); IsParseErr (err) {
644+ if _ , err := client.Do (ctx, client.B ().Get ().Key (" k" ).Build ()).ToArray (); rueidis. IsParseErr (err) {
645645 fmt.Println (" Parsing error:" , err)
646646}
647647```
You can’t perform that action at this time.
0 commit comments