Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /feeds/invalid route to Posts service #2412

Closed
humphd opened this issue Oct 29, 2021 · 4 comments · Fixed by #2520
Closed

Add /feeds/invalid route to Posts service #2412

humphd opened this issue Oct 29, 2021 · 4 comments · Fixed by #2520
Assignees
Labels
area: microservices area: redis Redis Database related area: web server Issues related to the web server type: enhancement New feature or request

Comments

@humphd
Copy link
Contributor

humphd commented Oct 29, 2021

In #2395 we are adding an expanded status service dashboard. One thing I want to include in it is the ability to see a list of all feeds that have been flagged as invalid in our system. @joshuali7536 did some work toward making this possible in #2388, and @manekenpix has done some more in #2396 to include the /feeds endpoint in the Posts service.

I'd like to see a new route get added to Posts:

GET /feeds/invalid

This should return a JSON array of Objects with the feed info as well as the reason why it was invalidated.

Doing so will require an update to how the Redis database code works in https://github.com/Seneca-CDOT/telescope/blob/master/src/backend/utils/storage.js. Currently when we invalidate a feed, we add the :invalid suffix to the feed key, and store the reason as its value.

Redis supports doing pattern matching on keys using the SCAN command with match. You can see an example in JS of what this looks like at https://github.com/luin/ioredis/blob/88b8a3125cd039afdac928c529a1b9958009979c/test/functional/scan_stream.ts#L50-L78. What we'd do is look for all keys like this:

t:feed:*:invalid

We can then use these keys to lookup the actual reason for each invalid feed, which is stored in the value for those keys. We'd use this to return the feed id (and probably URL) along with the reason why this feed was marked invalid.

Later we can use this route to create a widget on the status dashboard with a table of feeds and reasons for being marked invalid.

@humphd humphd added type: enhancement New feature or request area: redis Redis Database related area: web server Issues related to the web server area: microservices labels Oct 29, 2021
@hphan9
Copy link
Contributor

hphan9 commented Nov 7, 2021

Hi prof,
Could I try to work on this issue?
I want to learn more about Redis

@manekenpix
Copy link
Member

@hphan9 all yours!

@humphd
Copy link
Contributor Author

humphd commented Nov 21, 2021

@hphan9 you asked for this to be assigned 2 weeks ago, are you still working on it? If not I'll un-assign so someone else can work on it. What's the status?

@hphan9
Copy link
Contributor

hphan9 commented Nov 24, 2021

Hello prof. @humphd , I am sorry for the delay. I am working on it and I will send a PR soon.
I have a question about this

This should return a JSON array of Objects with the feed info as well as the reason why it was invalidated.

Doing so will require an update to how the Redis database code works in https://github.com/Seneca-CDOT/telescope/blob/master/src/backend/utils/storage.js. Currently when we invalidate a feed, we add the :invalid suffix to the feed key, and store the reason as its value.

Do you mean we should modify the setInvalidFeed(id,reason) to store all the information of the feed in the invalid key ?
I am still confused about this since we can get all the information of invalid keys from Redis without modifying the database code.
I have sent a draft Pull request here.
Could you please review it?
Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: microservices area: redis Redis Database related area: web server Issues related to the web server type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants