mirror of
https://codeberg.org/YGGverse/ytd.git
synced 2026-04-08 12:55:32 +00:00
handle db errors properly
This commit is contained in:
parent
b676060798
commit
28b614d5db
1 changed files with 14 additions and 6 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -44,13 +44,21 @@ async fn main() {
|
|||
let items = result.content.items;
|
||||
debug!("received {:?} items to handle...", items.len());
|
||||
for item in items {
|
||||
if database.get(&item.id).is_ok_and(|r| r.is_some()) {
|
||||
match database.get(&item.id) {
|
||||
Ok(id) => {
|
||||
if id.is_some() {
|
||||
debug!(
|
||||
"item `{}` for channel `{c}` already processed; skip handle.",
|
||||
item.id
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Err(e) => panic!(
|
||||
"can't check item `{}` in DB for channel `{c}`: {e}",
|
||||
item.id
|
||||
),
|
||||
}
|
||||
if item.is_live != channel.is_live {
|
||||
debug!(
|
||||
"skip item `{}` for channel `{c}` by `is_live` filter (item: {:?}/config:{:?})",
|
||||
|
|
@ -85,7 +93,7 @@ async fn main() {
|
|||
"exec `{cmd}` for channel `{c}` successful: `{:?}`",
|
||||
response
|
||||
),
|
||||
Err(e) => error!(
|
||||
Err(e) => panic!(
|
||||
"can't persist processed item `{}` for channel `{c}` by `{cmd}`: `{e}`",
|
||||
item.id
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue