133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
},
rss::Error::Eof => (),
_ => bail!("Unsupported or mangled content:\n{:?}\n{:#?}\n{:#?}\n", &source.url, err, status)
}
};
for (date, url) in posts.iter() {
let post_url: Cow<str> = match source.url_re {
Some(ref x) => sedregex::ReplaceCommand::new(x)?.execute(&source.url),
None => url.into(),
};
if let Some(exists) = sqlx::query!("select exists(select true from rsstg_post where url = $1 and source_id = $2) as exists;",
&post_url, *id).fetch_one(&mut self.pool.acquire().await?).await?.exists {
if ! exists {
if this_fetch.is_none() || *date > this_fetch.unwrap() {
this_fetch = Some(*date);
|
|
|
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
},
rss::Error::Eof => (),
_ => bail!("Unsupported or mangled content:\n{:?}\n{:#?}\n{:#?}\n", &source.url, err, status)
}
};
for (date, url) in posts.iter() {
let post_url: Cow<str> = match source.url_re {
Some(ref x) => sedregex::ReplaceCommand::new(x)?.execute(url),
None => url.into(),
};
if let Some(exists) = sqlx::query!("select exists(select true from rsstg_post where url = $1 and source_id = $2) as exists;",
&post_url, *id).fetch_one(&mut self.pool.acquire().await?).await?.exists {
if ! exists {
if this_fetch.is_none() || *date > this_fetch.unwrap() {
this_fetch = Some(*date);
|
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
owner_chat: telegram_bot::UserId::new(owner),
..self.clone()
};
task::spawn(async move {
if let Err(err) = clone.check(&source_id, owner, true).await {
if let Err(err) = clone.send(&format!("🛑 {:?}", err), None, None).await {
eprintln!("Check error: {}", err);
};
};
});
}
} else if next_fetch - now < delay {
delay = next_fetch - now;
}
|
>
|
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
owner_chat: telegram_bot::UserId::new(owner),
..self.clone()
};
task::spawn(async move {
if let Err(err) = clone.check(&source_id, owner, true).await {
if let Err(err) = clone.send(&format!("🛑 {:?}", err), None, None).await {
eprintln!("Check error: {}", err);
clone.disable(&source_id, owner).await.unwrap();
};
};
});
}
} else if next_fetch - now < delay {
delay = next_fetch - now;
}
|