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

Reduce number of CosmosDB write #371

Open
daphnecys opened this issue Oct 1, 2020 · 0 comments
Open

Reduce number of CosmosDB write #371

daphnecys opened this issue Oct 1, 2020 · 0 comments

Comments

@daphnecys
Copy link
Contributor

daphnecys commented Oct 1, 2020

Issue
The current GitHub action will call the Update Data every 10 minutes. The code in lockdown/backend/src/loaders/lockdown/lockdown.js batchGetTerritoriesEntryData() is called in "Update Data" action.

This code parses the Data Set Entry GSheet, recreate the JSONs and reinsert them into CosmosDB (MongoDB), clearing the DB first. This generates a huge amount of unnecessary inserts. We want to do the clear DB and entire parse only once each half hour, and every 10 minutes, just the updates.

The entire parse is necessary to ensure that the bug fix by this code change 2590e30 remains fixed, i.e. delete country entries where entries are blank.

Possible solution
Two methods are possible:

  1. Create 2 GitHub action, each half hour run the function with parameter to clear data in DB and regenerate JSONs. every 10 mins in the half hour, just the updates (function with no parameter).

  2. Keep an environment variable storing is the timestamp of the last clear all run. If more than half hour, clear data in DB and regenerate JSONs, otherwise just update without clear.

(Daphne's ref: June 25 convo with Mark)

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

No branches or pull requests

1 participant