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 scheduled job to automatically update language criteria #4088

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

Rebreda
Copy link

@Rebreda Rebreda commented Jun 22, 2023

I've tried to keep the PR small but I have refactored some older code to make it easier to use. Please read the comment in server/src/lib/jobs/sync-pontoon-statistics.ts to get an in-depth understanding of the logic being scheduled. In essence, Pontoon is a external dependency used to promote languages to be able to accept contributions. All existing logic is only run on startup, this PR aims to schedule a job that'll update language data periodically and decouple the progression of languages from startup.

I refactored how DB was instantiated and removed some other classes dependencies on DB - essentially turning it into a singleton, but the Node-y way (i.e. using a module). This means when called, the same instance of DB (now called "database") is used, making it easier to reason with.

I am also hoping to describe the schema used in the database via concrete objects and centralize how languages are accessed via the database (just like using an ORM). This needs more work though, so no guarantees I'll have it finished for this PR.

@Rebreda Rebreda requested a review from a team as a code owner June 22, 2023 18:28
@Rebreda Rebreda requested review from moz-dfeller and removed request for a team June 22, 2023 18:28
@Rebreda Rebreda changed the title [WIP] Create scheduled jobs to automatically update language criteria Add scheduled job to automatically update language criteria Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant