Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
metachris committed Jun 20, 2024
1 parent 31222c2 commit be96643
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,17 @@ func (s *Server) removeSubscriber(sub *SSESubscription) {
}

func (s *Server) SendTx(ctx context.Context, tx *common.TxIn) error {
s.log.Info("sending tx...")
s.sseConnectionLock.RLock()
defer s.sseConnectionLock.RUnlock()
if len(s.sseConnectionMap) == 0 {
return nil
}

txRLP, err := common.TxToRLPString(tx.Tx)
if err != nil {
return err
}

s.sseConnectionLock.RLock()
defer s.sseConnectionLock.RUnlock()
for _, sub := range s.sseConnectionMap {
sub.txC <- txRLP
}
Expand Down

0 comments on commit be96643

Please sign in to comment.