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

Find a more graceful way to update blocks/challenges in the database #17803

Closed
Bouncey opened this issue Jul 2, 2018 · 6 comments
Closed

Find a more graceful way to update blocks/challenges in the database #17803

Bouncey opened this issue Jul 2, 2018 · 6 comments
Assignees
Labels
help wanted Open for all. You do not need permission to work on these. platform: api Server application that needs familiarity with Express, Loopback, MongoDB etc. type: feature request Threads classified to be feature requests. Implementation to be considered as a nice to have type: showstopper Issues that are urgent and are critical path. These need immediate attention & shipping.

Comments

@Bouncey
Copy link
Member

Bouncey commented Jul 2, 2018

Currently, the flow for updating the curriculum in the database is to delete them all and re-seed.

We should really upsert them using the id they have been assigned.

Requirements of the script

  1. It should not remove all documents from the block and challenge collection in order to update the database
  2. It should upsert any changes to the documents in the block and challenge collection.
  3. It should remove documents from the collection that do not have a corresponding entry in the @freecodecamp/curriculum module
  4. It should not cause a bottleneck in the database, this script will be run in production on a live database
  5. There may be a requirement to implement an api endpoint to force loopback to reload the collections. Context: Loopback caches documents from the db in memory, any updates to those documents outside of the loopback api will require a manual reload. The script should also force the cachedMap to be regenerated.
@Bouncey Bouncey added help wanted Open for all. You do not need permission to work on these. type: showstopper Issues that are urgent and are critical path. These need immediate attention & shipping. platform: api Server application that needs familiarity with Express, Loopback, MongoDB etc. type: feature request Threads classified to be feature requests. Implementation to be considered as a nice to have labels Jul 2, 2018
@ghost

This comment has been minimized.

@ghost

This comment has been minimized.

@raisedadead
Copy link
Member

Bump. Still a critpath right?

@Bouncey
Copy link
Member Author

Bouncey commented Feb 24, 2019

Yes-ish.

I think we do not need challenges/blocks in the db any longer. There is no part of the application life cycle that updates the blocks or challenges. We can create any data structures we need at build time.

I would like to remove curriculum data from the db.

@raisedadead
Copy link
Member

We need them to lookup the challenge paths for a user if I am not mistaken in the UI? Is that being resolved in different way?

@Bouncey
Copy link
Member Author

Bouncey commented Feb 24, 2019

redirectToLearn uses the pathMigrationMap which is created at build time.

The challengeUrlResolver takes a challenge id (user.currentChallengeId), does a findById look up then builds the url from the document returned. This could be a build-time thing.

getFirstChallenge does a where query to find the first challenge. This could be a build-time thing.

boot/certificate uses a Challenge.findById to pull the project id's for each cert. This could be a build-time thing.

We never create, update or delete a Challenge/Block. Everything we query for could be a build time operation using the challenge markdown parser.

There are some legacy map-utils that I would look closely at and either remove them or do something at build time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Open for all. You do not need permission to work on these. platform: api Server application that needs familiarity with Express, Loopback, MongoDB etc. type: feature request Threads classified to be feature requests. Implementation to be considered as a nice to have type: showstopper Issues that are urgent and are critical path. These need immediate attention & shipping.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants