engine: on shutdown, stop stream processor before plugins
@@ -473,7 +473,6 @@ int flb_engine_start(struct flb_config *config)
/* Signal that we have started */
flb_engine_started(config);
-
while (1) {
mk_event_wait(evl);
mk_event_foreach(event, evl) {
@@ -536,6 +535,12 @@ int flb_engine_shutdown(struct flb_config *config)
config->is_running = FLB_FALSE;
flb_input_pause_all(config);
+#ifdef FLB_HAVE_STREAM_PROCESSOR
+ if (config->stream_processor_ctx) {
+ flb_sp_destroy(config->stream_processor_ctx);
+ }
+#endif
+
/* router */
flb_router_exit(config);
@@ -549,11 +554,6 @@ int flb_engine_shutdown(struct flb_config *config)
flb_input_exit_all(config);
flb_output_exit(config);
-#ifdef FLB_HAVE_STREAM_PROCESSOR
- if (config->stream_processor_ctx) {
- flb_sp_destroy(config->stream_processor_ctx);
- }
-#endif
/* Destroy the storage context */
flb_storage_destroy(config);
