KomodoPlatform / komodo-defi-framework

This is the official Komodo DeFi Framework repository
https://komodoplatform.com/en/docs/komodo-defi-framework/
103 stars 94 forks source link

Komodefi shouldn't panic incase of bad `event_stream_configuration` #2105

Open borngraced opened 5 months ago

borngraced commented 5 months ago
Screenshot 2024-04-30 at 13 35 22

currently, when Komodefi tries to parse incorrect event_stream_configuration, the program panics which doesn't sit well for me so I thought logging the error and continue with program is best

https://github.com/KomodoPlatform/komodo-defi-framework/blob/b0fd99e8406e67ea06435dd028991caa5f522b5c/mm2src/mm2_core/src/mm_ctx.rs#L725-L728

I guess this is better.

 let event_stream_configuration =
                    json::from_value(event_stream_configuration.clone());
                match event_stream_configuration {
                    Ok(config) => ctx.event_stream_configuration = Some(config),
                    Err(err) => {
                        error!("Bad/Invalid events streaming config, event streaming will be disregarded in this case: {err:?}");
                    }
                } 

cc @onur-ozkan

onur-ozkan commented 5 months ago

I am fine with either way; I don't have strong opinions about this, but I would expect an app to fail initialization if it starts with incorrect configuration. When we make a breaking change in the configuration, as the logs can easily be missed, people should have their apps fail on start so they will be aware of the breaking change.