File tree 1 file changed +15
-11
lines changed
1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -95,17 +95,21 @@ func (is *Service) publish(msg pubsub.Message) error {
95
95
}
96
96
97
97
if curr .Size () != 0 {
98
- start := time .Now ()
99
- err := sink .IndexTxEvents (curr .Ops )
100
- if err != nil {
101
- is .logger .Error ("failed to index block txs" ,
102
- "height" , is .currentBlock .height , "err" , err )
103
- } else {
104
- is .metrics .TxEventsSeconds .Observe (time .Since (start ).Seconds ())
105
- is .metrics .TransactionsIndexed .Add (float64 (curr .Size ()))
106
- is .logger .Debug ("indexed txs" ,
107
- "height" , is .currentBlock .height , "sink" , sink .Type ())
108
- }
98
+ go func () {
99
+ ops := curr .Ops
100
+ start := time .Now ()
101
+ err := sink .IndexTxEvents (ops )
102
+ if err != nil {
103
+ is .logger .Error ("failed to index block txs" ,
104
+ "height" , is .currentBlock .height , "err" , err )
105
+ } else {
106
+ is .metrics .TxEventsSeconds .Observe (time .Since (start ).Seconds ())
107
+ is .metrics .TransactionsIndexed .Add (float64 (curr .Size ()))
108
+ is .logger .Debug ("indexed txs" ,
109
+ "height" , is .currentBlock .height , "sink" , sink .Type ())
110
+ }
111
+ }()
112
+
109
113
}
110
114
}
111
115
is .currentBlock .batch = nil // return to the WAIT state for the next block
You can’t perform that action at this time.
0 commit comments