Add debug logs to github.rs
This commit is contained in:
parent
f3fc517d08
commit
f87a970067
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -1093,7 +1093,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kon"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
dependencies = [
|
||||
"kon_cmds",
|
||||
"kon_libs",
|
||||
@ -1122,7 +1122,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kon_libs"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"cargo_toml",
|
||||
"poise",
|
||||
@ -1141,7 +1141,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kon_tasks"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"feed-rs",
|
||||
"kon_libs",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kon"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
edition = "2024"
|
||||
|
||||
[workspace]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kon_libs"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
@ -26,7 +26,7 @@ impl ConfigMeta {
|
||||
Self {
|
||||
env: "prod".to_string(),
|
||||
embed_color: 0x5A99C7,
|
||||
ready_notify: 865673694184996888,
|
||||
ready_notify: 1268493237912604672,
|
||||
rss_channel: 865673694184996888,
|
||||
kon_logs: 1268493237912604672,
|
||||
developers: vec![
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kon_tasks"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
@ -9,6 +9,7 @@ use super::{
|
||||
parse,
|
||||
save_to_redis,
|
||||
task_err,
|
||||
task_info,
|
||||
trim_old_content
|
||||
};
|
||||
|
||||
@ -94,6 +95,7 @@ impl RSSFeed for GitHub {
|
||||
IncidentColorMap::Default.color()
|
||||
};
|
||||
|
||||
task_info("RSS:GitHub:Debug", &format!("Checking cache for incident ID: {}", &article.links[0].href));
|
||||
if cached_incident.is_empty() {
|
||||
save_to_redis(rkey, &get_incident_id(&article.links[0].href).unwrap()).await?;
|
||||
save_to_redis(&rkey_content, &new_content).await?;
|
||||
@ -108,6 +110,7 @@ impl RSSFeed for GitHub {
|
||||
} else {
|
||||
redis.set(&rkey_content, &new_content).await.unwrap();
|
||||
redis.expire(&rkey_content, 21600).await.unwrap();
|
||||
task_info("RSS:GitHub:Debug", "Incident added in cache and preparing to send embed to Discord");
|
||||
|
||||
Ok(Some(RSSFeedOutput::IncidentEmbed(embed(
|
||||
color,
|
||||
@ -120,6 +123,7 @@ impl RSSFeed for GitHub {
|
||||
} else {
|
||||
save_to_redis(rkey, &incident).await?;
|
||||
redis.set(&rkey_content, &new_content).await.unwrap();
|
||||
task_info("RSS:GitHub:Debug", "Incident updated in cache and preparing to send embed to Discord");
|
||||
|
||||
Ok(Some(RSSFeedOutput::IncidentEmbed(embed(
|
||||
color,
|
||||
|
@ -20,11 +20,7 @@ use {
|
||||
Http
|
||||
},
|
||||
regex::Regex,
|
||||
std::sync::Arc,
|
||||
tokio::time::{
|
||||
Duration,
|
||||
sleep
|
||||
}
|
||||
std::sync::Arc
|
||||
};
|
||||
|
||||
// This is for building up the embed with the feed data
|
||||
@ -79,9 +75,7 @@ async fn process_incident_embed(
|
||||
message.edit(http, EditMessage::new().embed(embed)).await?;
|
||||
}
|
||||
|
||||
sleep(Duration::from_secs(15)).await;
|
||||
|
||||
if Regex::new(r"(?i)\bresolved\b").unwrap().is_match(&new_description) {
|
||||
if Regex::new(r"(?i)^Resolved\s*-").unwrap().is_match(&new_description) {
|
||||
redis.del(redis_key).await?;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user