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

Update parser to fetch feeds from Supabase #2861

Closed
Kevan-Y opened this issue Feb 8, 2022 · 5 comments · Fixed by #3363
Closed

Update parser to fetch feeds from Supabase #2861

Kevan-Y opened this issue Feb 8, 2022 · 5 comments · Fixed by #3363
Assignees
Labels
area: microservices area: supabase Anything related to Supabase type: enhancement New feature or request
Milestone

Comments

@Kevan-Y
Copy link
Contributor

Kevan-Y commented Feb 8, 2022

What would you like to be added:

Currently, we have a parser that fetches feed from CDOT Feed List.
We want to update our parser to fetch feed from Supabase once #2860 is implemented.

@Kevan-Y Kevan-Y added type: enhancement New feature or request area: microservices area: supabase Anything related to Supabase labels Feb 8, 2022
@Kevan-Y Kevan-Y added this to the 2.8 Release milestone Feb 8, 2022
@TueeNguyen TueeNguyen self-assigned this Feb 8, 2022
@tpmai22 tpmai22 modified the milestones: 2.8 Release, 2.9 Release Mar 8, 2022
@tpmai22 tpmai22 self-assigned this Mar 8, 2022
@TueeNguyen
Copy link
Contributor

TueeNguyen commented Mar 29, 2022

After discussing. We decided to to

  • Write a seed script to migrate our wiki feeds to Supabase leveraging the /tools/migrate/migrate.js.
  • After seeding, find a way to persist the data (repo level like redis-data for development, and higher repo level for production like redis in production.yml
    redis:
    restart: unless-stopped
    volumes:
    # TODO: confirm this path...
    - ../../redis-data:/data
  • Modify this
    const [all, wiki] = await Promise.all([Feed.all(), getWikiFeeds()]);
    to something like
// Supabase may not allow us to return all data at once, if it's the case => do it in portions
const feeds = await getWiki() // getWiki() queries feeds from Supabase
  • For development, seeding all the feeds into Supabase may be too much, we thought of adding a small number of feeds but this is for later

cc @humphd @DukeManh

@TueeNguyen
Copy link
Contributor

Currently waiting for #3373 to merge previous test changes before I can continue to change the test to reflect on the parser's change

@humphd
Copy link
Contributor

humphd commented Apr 6, 2022

OK, #3373 is in, what's next?

@JerryHue
Copy link
Contributor

This issue is related to #1907, and #3355.

@JerryHue
Copy link
Contributor

JerryHue commented Apr 12, 2022

I would like to point out the things we need to also target for the parser service:

  • The parser service needs to pull the feeds from Supabase instead of redis and the wiki (done in Update parser to fetch feeds from Supabase #2861).
  • The parser service needs to invalidate the feeds on Supabase instead of redis.
  • The parser service needs to flag feeds on Supabase instead of redis.
  • The parser service does not need to updateFeeds anymore. Refer to:
    const currentFeed = await updateFeed(feed);

    const updateFeed = async (feedData) => {
    let currentFeed;
    // If we have an existing feed in the database for this URL, prefer that,
    // since it might have updated cache info (e.g., etag).
    const existingFeed = await Feed.byUrl(feedData.url);
    if (existingFeed) {
    // We have a version of this feed in the database already, prefer that
    currentFeed = existingFeed;
    } else {
    // First time we're seeing this feed, add it to the database
    const id = await Feed.create(feedData);
    currentFeed = await Feed.byId(id);
    }
    return currentFeed;
    };

We may target the previous concerns in a PR separate from #2861.

A few clarifications:

  • Redis may keep the etag and lastModified fields, since they would not be that ergonomic in Postgres.
  • Delayed feeds can be kept in Redis, since they would not be as ergonomic in Postgres.

@JerryHue JerryHue changed the title Update our parser services to use Supabase Update parser to fetch feeds from Supabase Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: microservices area: supabase Anything related to Supabase type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants