Closed craigspaeth closed 7 years ago
So the sync would run once but not the second time? Why didn't a restart of the app fix the problem?
A restart did fix it, but running sync
again would get the server stuck in the bad state. This was extra problematic because the first thing we do in sync
is db.members.drop()
, so running sync a second time would successfully drop the members collection and then get stuck on the CSV parsing—leaving the app with an emptied database.
Is the sync setup on a cron? Do those failures get reported to someone somewhere?
From what I can tell that sync is just run manually via GraphQL with errors reported in the GraphQL response. @orta Might know more.
I do, yep, the sync mutation is the only place it's happening. I ended up removing the chron jobs
Could someone please explain to me like a 2yo when and why we need this sync and why it's not on a cron?
Sure, this uses the new Web Stack Craig made ( MuralJS )
It uses GraphQL to handle all of the API architecture, the mutation we are talking about is using that. A mutation is the equivalent of a POST/PUT but that it also collects the side-effects of the changes from the data mutation (more here)
As this is the only MuralJS project I didn't want to be skipping the actual Mural paradigm and just write a separate sync.
I originally had a daily sync on a cron job (just a CURL to that API), but I removed it as I went OOO for 3 weeks and valued stability the team-nav. I moved a bunch of the cron jobs inline in #84 but had't got around to re-automating running the sync on a daily process in heroku.
Thanks Orta!
@dblock I'll add that this spreadsheet syncing is a pretty un-ideal solution, cron job or not. We discussed with People Ops eventually adopting a third party tool for this in the long term—or if we do continue with this in-house app, then IMO we should be using a better data model with some admin UI and not syncing over Google spreadsheets.
We're using csvtojson to convert the spreadsheet into members. Apparently, it is an issue to use the same instance of that
converter
, so this creates a new instance for everysync
we run.