mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-24 17:49:07 -05:00
fix: nip05 for postgres
This commit is contained in:
parent
05b08c7916
commit
c13961a5c4
|
@ -11,6 +11,8 @@ use crate::repo::NostrRepo;
|
|||
use crate::server::NostrMetrics;
|
||||
use governor::clock::Clock;
|
||||
use governor::{Quota, RateLimiter};
|
||||
use nostr::key::FromPkStr;
|
||||
use nostr::key::Keys;
|
||||
use r2d2;
|
||||
use sqlx::pool::PoolOptions;
|
||||
use sqlx::postgres::PgConnectOptions;
|
||||
|
@ -20,8 +22,6 @@ use std::thread;
|
|||
use std::time::{Duration, Instant};
|
||||
use tracing::log::LevelFilter;
|
||||
use tracing::{debug, info, trace, warn};
|
||||
use nostr::key::FromPkStr;
|
||||
use nostr::key::Keys;
|
||||
|
||||
pub type SqlitePool = r2d2::Pool<r2d2_sqlite::SqliteConnectionManager>;
|
||||
pub type PooledConnection = r2d2::PooledConnection<r2d2_sqlite::SqliteConnectionManager>;
|
||||
|
@ -303,7 +303,10 @@ pub async fn db_writer(
|
|||
continue;
|
||||
}
|
||||
}
|
||||
Err(Error::SqlError(rusqlite::Error::QueryReturnedNoRows)) => {
|
||||
Err(
|
||||
Error::SqlError(rusqlite::Error::QueryReturnedNoRows)
|
||||
| Error::SqlxError(sqlx::Error::RowNotFound),
|
||||
) => {
|
||||
debug!(
|
||||
"no verification records found for pubkey: {:?}",
|
||||
event.get_author_prefix()
|
||||
|
|
|
@ -384,7 +384,10 @@ impl Verifier {
|
|||
}
|
||||
}
|
||||
}
|
||||
Err(Error::SqlError(rusqlite::Error::QueryReturnedNoRows)) => {
|
||||
Err(
|
||||
Error::SqlError(rusqlite::Error::QueryReturnedNoRows)
|
||||
| Error::SqlxError(sqlx::Error::RowNotFound),
|
||||
) => {
|
||||
// No users need verification. Reset the interval to
|
||||
// the next verification attempt.
|
||||
let start = tokio::time::Instant::now() + self.wait_after_finish;
|
||||
|
|
|
@ -950,7 +950,10 @@ impl FromRow<'_, PgRow> for VerificationRecord {
|
|||
address: hex::encode(row.get::<'_, Vec<u8>, &str>("pub_key")),
|
||||
event: hex::encode(row.get::<'_, Vec<u8>, &str>("event_id")),
|
||||
event_created: row.get::<'_, DateTime<Utc>, &str>("created_at").timestamp() as u64,
|
||||
last_success: None,
|
||||
last_success: match row.try_get::<'_, DateTime<Utc>, &str>("verified_at") {
|
||||
Ok(x) => Some(x.timestamp() as u64),
|
||||
_ => None,
|
||||
},
|
||||
last_failure: match row.try_get::<'_, DateTime<Utc>, &str>("failed_at") {
|
||||
Ok(x) => Some(x.timestamp() as u64),
|
||||
_ => None,
|
||||
|
|
Loading…
Reference in New Issue
Block a user