Skip to content

Commit

Permalink
[NO_TICKET] fix: run spanner relational queries sequential to prevent…
Browse files Browse the repository at this point in the history
… seqno errors (#10)

* fix: run spanner relational queries sequential to prevent seqno errors
* fix: update package-lock
  • Loading branch information
Xevi committed Jul 4, 2023
1 parent e9baaa8 commit 5f88552
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@streamyard/typeorm",
"private": true,
"version": "0.3.16-1",
"version": "0.3.16-2",
"description": "Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB, Spanner databases.",
"license": "MIT",
"readmeFilename": "README.md",
Expand Down
5 changes: 4 additions & 1 deletion src/persistence/SubjectExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ export class SubjectExecutor {
* Updates all given subjects in the database.
*/
protected async executeUpdateOperations(): Promise<void> {
const isSpanner =
this.queryRunner.connection.driver.options.type === "spanner"

const updateSubject = async (subject: Subject) => {
if (!subject.identifier)
throw new SubjectWithoutIdentifierError(subject)
Expand Down Expand Up @@ -645,7 +648,7 @@ export class SubjectExecutor {
const remainingSubjects: Subject[] = []

for (const subject of this.updateSubjects) {
if (subject.metadata.treeType === "nested-set") {
if (subject.metadata.treeType === "nested-set" || isSpanner) {
nestedSetSubjects.push(subject)
} else {
remainingSubjects.push(subject)
Expand Down

0 comments on commit 5f88552

Please sign in to comment.