fix: remove eventual consistency for program_grouping upserts (#843)

Now that we are fully relying on our own internal DB relations for
program hierarchies (shows, seasons, albums, artists), we cannot use
eventual consistency for saving these relations when upserting programs.
This creates issues like #825, when sometimes groupings aren't fully
available after successfully creating a lineup.

This includes the following changes to speed things up and synchronously
save program_groupings:

* Completely remove usages of mikro-orm on the upsert programs path.
  Everything is handled by lower level query builders via kysely
* Save program_grouping and critical program_grouping_external_ids with
  immediate consistency
* Defer saving PLEX_GUID type external IDs to the background
* Properly defer saving non-critical external IDs until after the
  request is returned
* Stop validating requests/responses client-side via Zod. The backend
  already does this so we were duplicating work here and slowing things
down considerably.
* Moves upsertContentPrograms to ProgramDB
* Removes kysely types that were generated with kysely-codegen because
  it oversimplified all underlying DB types

Fixes #825
This commit is contained in:
Christian Benincasa
2024-10-09 12:50:45 -04:00
committed by GitHub
parent 577123872f
commit d83113bbaa
70 changed files with 2607 additions and 1480 deletions

View File

@@ -58,7 +58,7 @@
"fastify-plugin": "^4.5.1",
"fastify-print-routes": "^3.2.0",
"fastify-type-provider-zod": "^1.1.9",
"kysely": "^0.27.3",
"kysely": "^0.27.4",
"lodash-es": "^4.17.21",
"lowdb": "^7.0.0",
"node-cache": "^5.1.2",
@@ -71,6 +71,7 @@
"random-js": "2.1.0",
"reflect-metadata": "^0.2.2",
"retry": "^0.13.1",
"ts-pattern": "^5.4.0",
"tslib": "^2.6.2",
"uuid": "^9.0.1",
"yargs": "^17.7.2",