Skip to content

Commit

Permalink
add timeout to context
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tron committed Jul 22, 2023
1 parent 243457d commit de60b2f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/api/event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (h Handler) SendMessage(ctx context.Context, req oas.SendMessageReq) (r oas
if err := h.msgSender.SendMessage(ctx, payload); err != nil {
return &oas.InternalError{Error: err.Error()}, nil
}
go h.addToMempool(context.Background(), payload)
go h.addToMempool(payload)
return &oas.SendMessageOK{}, nil
}

Expand Down Expand Up @@ -352,7 +352,9 @@ func (h Handler) EmulateWalletMessage(ctx context.Context, req oas.EmulateWallet
return &consequences, nil
}

func (h Handler) addToMempool(ctx context.Context, bytesBoc []byte) {
func (h Handler) addToMempool(bytesBoc []byte) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
msgCell, err := boc.DeserializeBoc(bytesBoc)
if err != nil {
return
Expand Down

0 comments on commit de60b2f

Please sign in to comment.