155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
let row = sqlx::query("select exists(select true from rsstg_post where url = $1 and source_id = $2) as exists;")
.bind(post_url)
.bind(id.into())
.fetch_one(&mut *self.0).await.stack()?;
if let Some(exists) = row.try_get("exists").stack()? {
Ok(exists)
} else {
bail!("Database error: can't check whether source exists.");
}
}
/// Get all pending events for (now + 1 minute)
pub async fn get_queue (&mut self) -> Result<Vec<Queue>> {
let block: Vec<Queue> = sqlx::query_as("select source_id, next_fetch, owner, last_scrape from rsstg_order natural left join rsstg_source where next_fetch < now() + interval '1 minute';")
.fetch_all(&mut *self.0).await.stack()?;
|
|
|
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
let row = sqlx::query("select exists(select true from rsstg_post where url = $1 and source_id = $2) as exists;")
.bind(post_url)
.bind(id.into())
.fetch_one(&mut *self.0).await.stack()?;
if let Some(exists) = row.try_get("exists").stack()? {
Ok(exists)
} else {
bail!("Database error: can't check whether post exists.");
}
}
/// Get all pending events for (now + 1 minute)
pub async fn get_queue (&mut self) -> Result<Vec<Queue>> {
let block: Vec<Queue> = sqlx::query_as("select source_id, next_fetch, owner, last_scrape from rsstg_order natural left join rsstg_source where next_fetch < now() + interval '1 minute';")
.fetch_all(&mut *self.0).await.stack()?;
|