Closed berekuk closed 2 years ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
metaforecast | ✅ Ready (Inspect) | Visit Preview | Apr 27, 2022 at 6:29PM (UTC) |
Ok, I'll just merge it.
@NunoSempere, let me know if you're not ok with this:
only the question title links to the original url now
(instead of an entire question card)
Hey, this looks good to me
So this is a mix of several changes, some are unfinished:
master
instead, but I disabled the links to question pages for now, so it should be ok)Fix for upserts - kinda urgent
I was working on adding foreign keys from
history
toquestions
table when I discovered that fetchers were broken in prod due to the unfortunate combination of: (1) frontpage table is now implemented with foreign keys toquestions
table now; (2) fetched questions are inserted with delete+recreate trick.But foreign keys forbid the questions from being deleted, so deletes failed, and cron job skipped the platform entirely if it had any questions on the frontpage. At least that's what I assume have happened, I haven't checked the full logs.
What's worse is that there's no easy to fix this while keeping the same performance. The only fix I could come up with quickly negates the benefits of #30: in this PR I just delete the questions which don't exist any more, create the new ones and update the ones which existed. But there's no bulk update API in Prisma (or in SQL, actually), so all updates are done in separate SQL queries. Or, to be more precise, in 5 queries per question:
It shouldn't be that bad, though, since our DB is now geographically close to Heroku's instance. And this can be optimized further:
UPDATE ... FROM ...
(but this is impossible with Prisma, so we'll have to drop back to the raw SQL...)On other stuff in this PR: