@@ -165,6 +165,22 @@ impl Service {
165
165
} )
166
166
. expect ( "unable to spawn thread" ) ;
167
167
168
+ // Enable HTTP Predicates API, if required
169
+ if let PredicatesApi :: On ( ref api_config) = self . config . http_api {
170
+ info ! (
171
+ self . ctx. expect_logger( ) ,
172
+ "Listening on port {} for chainhook predicate registrations" , api_config. http_port
173
+ ) ;
174
+ let ctx = self . ctx . clone ( ) ;
175
+ let api_config = api_config. clone ( ) ;
176
+ let moved_observer_command_tx = observer_command_tx. clone ( ) ;
177
+ // Test and initialize a database connection
178
+ let _ = hiro_system_kit:: thread_named ( "HTTP Predicate API" ) . spawn ( move || {
179
+ let future = start_predicate_api_server ( api_config, moved_observer_command_tx, ctx) ;
180
+ let _ = hiro_system_kit:: nestable_block_on ( future) ;
181
+ } ) ;
182
+ }
183
+
168
184
info ! (
169
185
self . ctx. expect_logger( ) ,
170
186
"Listening on port {} for Stacks chain events" , event_observer_config. ingestion_port
@@ -183,21 +199,6 @@ impl Service {
183
199
) ;
184
200
}
185
201
}
186
- // Enable HTTP Chainhook API, if required
187
- if let PredicatesApi :: On ( ref api_config) = self . config . http_api {
188
- info ! (
189
- self . ctx. expect_logger( ) ,
190
- "Listening for chainhook predicate registrations on port {}" , api_config. http_port
191
- ) ;
192
- let ctx = self . ctx . clone ( ) ;
193
- let api_config = api_config. clone ( ) ;
194
- let moved_observer_command_tx = observer_command_tx. clone ( ) ;
195
- // Test and initialize a database connection
196
- let _ = hiro_system_kit:: thread_named ( "HTTP Predicate API" ) . spawn ( move || {
197
- let future = start_predicate_api_server ( api_config, moved_observer_command_tx, ctx) ;
198
- let _ = hiro_system_kit:: nestable_block_on ( future) ;
199
- } ) ;
200
- }
201
202
202
203
let mut stacks_event = 0 ;
203
204
loop {
0 commit comments