fix
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/cron/build Pipeline was successful

This commit is contained in:
JMARyA 2024-12-12 22:46:08 +01:00
parent 55de117456
commit b611264331
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -102,9 +102,9 @@ impl DatabaseBackend {
if let Some(postgres) = self.postgres.as_ref() { if let Some(postgres) = self.postgres.as_ref() {
sqlx::query( sqlx::query(
r#" r#"
INSERT INTO item_log (module, name, url, CURRENT_TIMESTAMP) INSERT INTO item_log (module, name, url, timestamp)
VALUES ($1, $2, $3) VALUES ($1, $2, $3, CURRENT_TIMESTAMP)
ON CONFLICT (module, name, url) ON CONFLICT (module, name, url)
DO UPDATE SET timestamp = CURRENT_TIMESTAMP DO UPDATE SET timestamp = CURRENT_TIMESTAMP
"#, "#,
) )
@ -165,7 +165,13 @@ impl Database {
pub fn insert_url(&self, module: &str, name: &str, url: &str) { pub fn insert_url(&self, module: &str, name: &str, url: &str) {
let rt = tokio::runtime::Runtime::new().unwrap(); let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(async { rt.block_on(async {
self.conn.query(Query::InsertUrl(module.to_string(), name.to_string(), url.to_string())).await; self.conn
.query(Query::InsertUrl(
module.to_string(),
name.to_string(),
url.to_string(),
))
.await;
}); });
} }