AgileVentures / MetPlus_tracker

Git Repository for the Waffle issue in MetPlus project
2 stars 4 forks source link

Mongo DB out of sync with Rails DB #718

Closed tansaku closed 6 years ago

tansaku commented 6 years ago

It seems that we can end up in a state where the Mongo DB on the cruncher is out of sync with the Postgres DB in use by the Rails app. In particular doing a match for all job seekers on a particular job in the rails db, requires the same job to be present in the mongodb.

tansaku commented 6 years ago

When a job is missing from the cruncher db we get the following output on pets:

Which is associated with the following output in the cruncher logs:

2018-07-13T10:43:38.246543429Z app[web.1]: 2018-07-13 10:43:38.246 ERROR 10 --- [nio-5000-exec-6] o.m.c.web.controllers.ResumeController   : Unable to find job with id: 3

A simple first step would be to better handle the error on the rails app side, i.e. displaying a sensible error message rather than crashing.

Also useful would be a mechanism to allow the databases to be synced. Apparently when a job is created on the rails app, it is then also passed over to the cruncher for storage in it's db? Or at least a reference to it is. An admin task to replicate that would allow us to repair the db state without editing directly.

A more general fix might be to avoid the requirement to store the data (or reference) about the job in both dbs so that job seekers could be matched without requiring the job data in both places, e.g. sending it over when the match request comes through or similar