fix
This commit is contained in:
parent
55de117456
commit
b611264331
1 changed files with 10 additions and 4 deletions
14
src/db.rs
14
src/db.rs
|
@ -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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue