Fix sentry http request info
Add async bot running with semaphore
This commit is contained in:
+6
-7
@@ -24,20 +24,21 @@ fn main() -> anyhow::Result<()> {
|
||||
)
|
||||
.init();
|
||||
|
||||
if let Ok(sentry_dsn) = env::try_get_env("SENTRY_DSN") {
|
||||
let _sentry_guard = if let Ok(sentry_dsn) = env::try_get_env("SENTRY_DSN") {
|
||||
info!("Initialize sentry");
|
||||
|
||||
let _guard = sentry::init((
|
||||
Some(sentry::init((
|
||||
sentry_dsn,
|
||||
sentry::ClientOptions {
|
||||
release: sentry::release_name!(),
|
||||
send_default_pii: true,
|
||||
..Default::default()
|
||||
},
|
||||
));
|
||||
)))
|
||||
} else {
|
||||
warn!("SENTRY_DSN not set, sentry will not be initialized");
|
||||
}
|
||||
None
|
||||
};
|
||||
|
||||
tokio::runtime::Runtime::new()?.block_on(run())
|
||||
}
|
||||
@@ -54,9 +55,7 @@ async fn run() -> anyhow::Result<()> {
|
||||
);
|
||||
|
||||
let bot = Bot::new(config.clone())?;
|
||||
|
||||
let (tx, rx) = tokio::sync::mpsc::channel::<WebhookType>(1);
|
||||
|
||||
let (tx, rx) = tokio::sync::mpsc::channel::<WebhookType>(config.bot_max_concurrent * 2);
|
||||
let app_state = AppState { bot_tx: tx, config };
|
||||
|
||||
tokio::try_join!(bot.start(rx), api::start(app_state))?;
|
||||
|
||||
Reference in New Issue
Block a user