Skip to content

Commit

Permalink
patch BigQuery client to not wait infinite for canceled job googleapi…
Browse files Browse the repository at this point in the history
  • Loading branch information
zajca committed Nov 1, 2023
1 parent 88954d1 commit 3b409a4
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 7 deletions.
17 changes: 13 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
"description": "Transformation component for Google BigQuery",
"license": "MIT",
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-odbc": "*",
"google/cloud-bigquery": "^1.23",
"jdorn/sql-formatter": "^1.2",
"keboola/php-component": "^9.0",
"keboola/table-backend-utils": "^2.0"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.3",
"cweagans/composer-patches": "^1.7",
"keboola/coding-standard": ">=7.0.2",
"keboola/datadir-tests": "^5.3",
"keboola/php-temp": "^2.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.5",
"symfony/process": "^5.0"
Expand All @@ -38,7 +39,6 @@
"@tests-phpunit",
"@tests-datadir"
],

"phpstan": "phpstan analyse ./src ./tests --level=max --no-progress -c phpstan.neon",
"phpcs": "phpcs -n --ignore=vendor --extensions=php .",
"phpcbf": "phpcbf -n --ignore=vendor --extensions=php .",
Expand All @@ -58,7 +58,16 @@
"sort-packages": true,
"optimize-autoloader": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"cweagans/composer-patches": true
}
},
"extra": {
"composer-exit-on-patch-failure": true,
"patches": {
"google/cloud-bigquery": [
"patches/google-cloud-bigquery-JobWaitTrait.php.patch"
]
}
}
}
54 changes: 51 additions & 3 deletions composer.lock

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

13 changes: 13 additions & 0 deletions patches/google-cloud-bigquery-JobWaitTrait.php.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- src/JobWaitTrait.php 2023-11-01 13:07:13.826212516 +0100
+++ src/JobWaitTrait.php 2023-11-01 13:07:24.542742533 +0100
@@ -55,7 +55,9 @@
}
};

- (new ExponentialBackoff($maxRetries))
+ (new ExponentialBackoff($maxRetries, function (\Throwable $e) {
+ return $e->getCode() !== 499;
+ }))
->execute($retryFn);
}
}

0 comments on commit 3b409a4

Please sign in to comment.