Skip to content

Commit

Permalink
chore(term): logging feeds that failed to fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgyt committed May 5, 2024
1 parent fecafd9 commit 425548c
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 13 deletions.
8 changes: 4 additions & 4 deletions crates/synd_term/gql/mutation.gql
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ fragment Feed on Feed {
}

fragment EntryMeta on Entry {
title,
published,
updated,
summary,
title
published
updated
summary
}

fragment Link on Link {
Expand Down
12 changes: 8 additions & 4 deletions crates/synd_term/gql/query.gql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ query Subscription($after: String, $first: Int) {
pageInfo {
...PageInfo
}
errors {
url
errorMessage
}
}
}
}
Expand Down Expand Up @@ -38,10 +42,10 @@ fragment Feed on Feed {
}

fragment EntryMeta on Entry {
title,
published,
updated,
summary,
title
published
updated
summary
}

fragment Link on Link {
Expand Down
67 changes: 67 additions & 0 deletions crates/synd_term/gql/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,30 @@
}
}
}
},
{
"args": [],
"deprecationReason": null,
"description": null,
"isDeprecated": false,
"name": "errors",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "FetchFeedError",
"ofType": null
}
}
}
}
}
],
"inputFields": null,
Expand Down Expand Up @@ -838,6 +862,49 @@
"name": "FeedUrl",
"possibleTypes": null
},
{
"description": null,
"enumValues": null,
"fields": [
{
"args": [],
"deprecationReason": null,
"description": null,
"isDeprecated": false,
"name": "url",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "FeedUrl",
"ofType": null
}
}
},
{
"args": [],
"deprecationReason": null,
"description": null,
"isDeprecated": false,
"name": "errorMessage",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
}
],
"inputFields": null,
"interfaces": [],
"kind": "OBJECT",
"name": "FetchFeedError",
"possibleTypes": null
},
{
"description": "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",
"enumValues": null,
Expand Down
4 changes: 4 additions & 0 deletions crates/synd_term/src/application/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ impl Application {
first: subscription.feeds.nodes.len().try_into().unwrap_or(0),
}
});
// how we show fetched errors in ui?
if !subscription.feeds.errors.is_empty() {
tracing::warn!("Failed fetched feeds: {:?}", subscription.feeds.errors);
}
self.components
.subscription
.update_subscription(populate, subscription);
Expand Down
4 changes: 2 additions & 2 deletions crates/synd_term/src/client/mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod subscribe_feed {
#![allow(dead_code)]
use std::result::Result;
pub const OPERATION_NAME: &str = "SubscribeFeed";
pub const QUERY : & str = "mutation SubscribeFeed($subscribeInput: SubscribeFeedInput!) {\n subscribeFeed(input: $subscribeInput) {\n __typename\n ... on SubscribeFeedSuccess {\n feed {\n ...Feed\n }\n status {\n code\n }\n }\n ... on SubscribeFeedError {\n status {\n code\n }\n message\n }\n }\n}\n\nmutation UnsubscribeFeed($unsubscribeInput: UnsubscribeFeedInput!) {\n unsubscribeFeed(input: $unsubscribeInput) {\n __typename\n ... on UnsubscribeFeedSuccess {\n status {\n code\n }\n }\n ... on UnsubscribeFeedError {\n status {\n code\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 20) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title,\n published,\n updated,\n summary,\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n" ;
pub const QUERY : & str = "mutation SubscribeFeed($subscribeInput: SubscribeFeedInput!) {\n subscribeFeed(input: $subscribeInput) {\n __typename\n ... on SubscribeFeedSuccess {\n feed {\n ...Feed\n }\n status {\n code\n }\n }\n ... on SubscribeFeedError {\n status {\n code\n }\n message\n }\n }\n}\n\nmutation UnsubscribeFeed($unsubscribeInput: UnsubscribeFeedInput!) {\n unsubscribeFeed(input: $unsubscribeInput) {\n __typename\n ... on UnsubscribeFeedSuccess {\n status {\n code\n }\n }\n ... on UnsubscribeFeedError {\n status {\n code\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 20) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title\n published\n updated\n summary\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n" ;
use super::*;
use serde::{Deserialize, Serialize};
#[allow(dead_code)]
Expand Down Expand Up @@ -217,7 +217,7 @@ pub mod unsubscribe_feed {
#![allow(dead_code)]
use std::result::Result;
pub const OPERATION_NAME: &str = "UnsubscribeFeed";
pub const QUERY : & str = "mutation SubscribeFeed($subscribeInput: SubscribeFeedInput!) {\n subscribeFeed(input: $subscribeInput) {\n __typename\n ... on SubscribeFeedSuccess {\n feed {\n ...Feed\n }\n status {\n code\n }\n }\n ... on SubscribeFeedError {\n status {\n code\n }\n message\n }\n }\n}\n\nmutation UnsubscribeFeed($unsubscribeInput: UnsubscribeFeedInput!) {\n unsubscribeFeed(input: $unsubscribeInput) {\n __typename\n ... on UnsubscribeFeedSuccess {\n status {\n code\n }\n }\n ... on UnsubscribeFeedError {\n status {\n code\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 20) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title,\n published,\n updated,\n summary,\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n" ;
pub const QUERY : & str = "mutation SubscribeFeed($subscribeInput: SubscribeFeedInput!) {\n subscribeFeed(input: $subscribeInput) {\n __typename\n ... on SubscribeFeedSuccess {\n feed {\n ...Feed\n }\n status {\n code\n }\n }\n ... on SubscribeFeedError {\n status {\n code\n }\n message\n }\n }\n}\n\nmutation UnsubscribeFeed($unsubscribeInput: UnsubscribeFeedInput!) {\n unsubscribeFeed(input: $unsubscribeInput) {\n __typename\n ... on UnsubscribeFeedSuccess {\n status {\n code\n }\n }\n ... on UnsubscribeFeedError {\n status {\n code\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 20) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title\n published\n updated\n summary\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n" ;
use super::*;
use serde::{Deserialize, Serialize};
#[allow(dead_code)]
Expand Down
13 changes: 10 additions & 3 deletions crates/synd_term/src/client/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod subscription {
#![allow(dead_code)]
use std::result::Result;
pub const OPERATION_NAME: &str = "Subscription";
pub const QUERY : & str = "query Subscription($after: String, $first: Int) {\n output: subscription {\n feeds(after: $after, first: $first) {\n nodes {\n ...Feed\n }\n pageInfo {\n ...PageInfo\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 10) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title,\n published,\n updated,\n summary,\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n\nquery Entries($after: String, $first: Int!) {\n output: subscription {\n entries(after: $after, first: $first) {\n nodes {\n ...Entry\n }\n pageInfo {\n ...PageInfo\n }\n }\n }\n}\n\nfragment Entry on Entry {\n title\n published\n updated\n summary\n websiteUrl\n feed {\n ...FeedMeta\n }\n}\n\nfragment FeedMeta on FeedMeta {\n title\n url\n requirement\n category\n}\n\nfragment PageInfo on PageInfo {\n hasNextPage\n endCursor\n}\n\nquery ExportSubscription($after: String, $first: Int!) {\n output: subscription {\n feeds(after: $after, first: $first) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n title\n url\n }\n }\n }\n}\n" ;
pub const QUERY : & str = "query Subscription($after: String, $first: Int) {\n output: subscription {\n feeds(after: $after, first: $first) {\n nodes {\n ...Feed\n }\n pageInfo {\n ...PageInfo\n }\n errors {\n url\n errorMessage\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 10) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title\n published\n updated\n summary\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n\nquery Entries($after: String, $first: Int!) {\n output: subscription {\n entries(after: $after, first: $first) {\n nodes {\n ...Entry\n }\n pageInfo {\n ...PageInfo\n }\n }\n }\n}\n\nfragment Entry on Entry {\n title\n published\n updated\n summary\n websiteUrl\n feed {\n ...FeedMeta\n }\n}\n\nfragment FeedMeta on FeedMeta {\n title\n url\n requirement\n category\n}\n\nfragment PageInfo on PageInfo {\n hasNextPage\n endCursor\n}\n\nquery ExportSubscription($after: String, $first: Int!) {\n output: subscription {\n feeds(after: $after, first: $first) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n title\n url\n }\n }\n }\n}\n" ;
use super::*;
use serde::{Deserialize, Serialize};
#[allow(dead_code)]
Expand Down Expand Up @@ -153,9 +153,16 @@ pub mod subscription {
pub nodes: Vec<SubscriptionOutputFeedsNodes>,
#[serde(rename = "pageInfo")]
pub page_info: SubscriptionOutputFeedsPageInfo,
pub errors: Vec<SubscriptionOutputFeedsErrors>,
}
pub type SubscriptionOutputFeedsNodes = Feed;
pub type SubscriptionOutputFeedsPageInfo = PageInfo;
#[derive(Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct SubscriptionOutputFeedsErrors {
pub url: FeedUrl,
#[serde(rename = "errorMessage")]
pub error_message: String,
}
}
impl graphql_client::GraphQLQuery for Subscription {
type Variables = subscription::Variables;
Expand All @@ -173,7 +180,7 @@ pub mod entries {
#![allow(dead_code)]
use std::result::Result;
pub const OPERATION_NAME: &str = "Entries";
pub const QUERY : & str = "query Subscription($after: String, $first: Int) {\n output: subscription {\n feeds(after: $after, first: $first) {\n nodes {\n ...Feed\n }\n pageInfo {\n ...PageInfo\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 10) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title,\n published,\n updated,\n summary,\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n\nquery Entries($after: String, $first: Int!) {\n output: subscription {\n entries(after: $after, first: $first) {\n nodes {\n ...Entry\n }\n pageInfo {\n ...PageInfo\n }\n }\n }\n}\n\nfragment Entry on Entry {\n title\n published\n updated\n summary\n websiteUrl\n feed {\n ...FeedMeta\n }\n}\n\nfragment FeedMeta on FeedMeta {\n title\n url\n requirement\n category\n}\n\nfragment PageInfo on PageInfo {\n hasNextPage\n endCursor\n}\n\nquery ExportSubscription($after: String, $first: Int!) {\n output: subscription {\n feeds(after: $after, first: $first) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n title\n url\n }\n }\n }\n}\n" ;
pub const QUERY : & str = "query Subscription($after: String, $first: Int) {\n output: subscription {\n feeds(after: $after, first: $first) {\n nodes {\n ...Feed\n }\n pageInfo {\n ...PageInfo\n }\n errors {\n url\n errorMessage\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 10) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title\n published\n updated\n summary\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n\nquery Entries($after: String, $first: Int!) {\n output: subscription {\n entries(after: $after, first: $first) {\n nodes {\n ...Entry\n }\n pageInfo {\n ...PageInfo\n }\n }\n }\n}\n\nfragment Entry on Entry {\n title\n published\n updated\n summary\n websiteUrl\n feed {\n ...FeedMeta\n }\n}\n\nfragment FeedMeta on FeedMeta {\n title\n url\n requirement\n category\n}\n\nfragment PageInfo on PageInfo {\n hasNextPage\n endCursor\n}\n\nquery ExportSubscription($after: String, $first: Int!) {\n output: subscription {\n feeds(after: $after, first: $first) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n title\n url\n }\n }\n }\n}\n" ;
use super::*;
use serde::{Deserialize, Serialize};
#[allow(dead_code)]
Expand Down Expand Up @@ -279,7 +286,7 @@ pub mod export_subscription {
#![allow(dead_code)]
use std::result::Result;
pub const OPERATION_NAME: &str = "ExportSubscription";
pub const QUERY : & str = "query Subscription($after: String, $first: Int) {\n output: subscription {\n feeds(after: $after, first: $first) {\n nodes {\n ...Feed\n }\n pageInfo {\n ...PageInfo\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 10) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title,\n published,\n updated,\n summary,\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n\nquery Entries($after: String, $first: Int!) {\n output: subscription {\n entries(after: $after, first: $first) {\n nodes {\n ...Entry\n }\n pageInfo {\n ...PageInfo\n }\n }\n }\n}\n\nfragment Entry on Entry {\n title\n published\n updated\n summary\n websiteUrl\n feed {\n ...FeedMeta\n }\n}\n\nfragment FeedMeta on FeedMeta {\n title\n url\n requirement\n category\n}\n\nfragment PageInfo on PageInfo {\n hasNextPage\n endCursor\n}\n\nquery ExportSubscription($after: String, $first: Int!) {\n output: subscription {\n feeds(after: $after, first: $first) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n title\n url\n }\n }\n }\n}\n" ;
pub const QUERY : & str = "query Subscription($after: String, $first: Int) {\n output: subscription {\n feeds(after: $after, first: $first) {\n nodes {\n ...Feed\n }\n pageInfo {\n ...PageInfo\n }\n errors {\n url\n errorMessage\n }\n }\n }\n}\n\nfragment Feed on Feed {\n id\n type\n title\n url\n updated\n websiteUrl\n description\n generator\n requirement\n category\n entries(first: 10) {\n nodes {\n ...EntryMeta\n }\n }\n links {\n nodes {\n ...Link\n }\n }\n authors {\n nodes\n }\n}\n\nfragment EntryMeta on Entry {\n title\n published\n updated\n summary\n}\n\nfragment Link on Link {\n href\n rel\n mediaType\n title \n}\n\nquery Entries($after: String, $first: Int!) {\n output: subscription {\n entries(after: $after, first: $first) {\n nodes {\n ...Entry\n }\n pageInfo {\n ...PageInfo\n }\n }\n }\n}\n\nfragment Entry on Entry {\n title\n published\n updated\n summary\n websiteUrl\n feed {\n ...FeedMeta\n }\n}\n\nfragment FeedMeta on FeedMeta {\n title\n url\n requirement\n category\n}\n\nfragment PageInfo on PageInfo {\n hasNextPage\n endCursor\n}\n\nquery ExportSubscription($after: String, $first: Int!) {\n output: subscription {\n feeds(after: $after, first: $first) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n title\n url\n }\n }\n }\n}\n" ;
use super::*;
use serde::{Deserialize, Serialize};
#[allow(dead_code)]
Expand Down

0 comments on commit 425548c

Please sign in to comment.