fix
This commit is contained in:
parent
55de117456
commit
b611264331
1 changed files with 10 additions and 4 deletions
12
src/db.rs
12
src/db.rs
|
@ -102,8 +102,8 @@ impl DatabaseBackend {
|
|||
if let Some(postgres) = self.postgres.as_ref() {
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT INTO item_log (module, name, url, CURRENT_TIMESTAMP)
|
||||
VALUES ($1, $2, $3)
|
||||
INSERT INTO item_log (module, name, url, timestamp)
|
||||
VALUES ($1, $2, $3, CURRENT_TIMESTAMP)
|
||||
ON CONFLICT (module, name, url)
|
||||
DO UPDATE SET timestamp = CURRENT_TIMESTAMP
|
||||
"#,
|
||||
|
@ -165,7 +165,13 @@ impl Database {
|
|||
pub fn insert_url(&self, module: &str, name: &str, url: &str) {
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue