Skip to content

Commit

Permalink
PubSub version upgrade and changed subscription retry count to 5 (#475)
Browse files Browse the repository at this point in the history
* updates

* Update pubSubUtil.js

* package updates

* scope update

* Update dataManager.js

* Update dataManager.js

* Update dataManager.js
  • Loading branch information
mservidio authored Apr 13, 2021
1 parent c2ddcb3 commit 102fd13
Show file tree
Hide file tree
Showing 7 changed files with 511 additions and 1,179 deletions.
887 changes: 285 additions & 602 deletions api/v1alpha/package-lock.json

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions api/v1alpha/src/admin/dataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ async function startPubSubListener() {
await retry(async bail => {
await initializePubSubListener();
}, {
// retries: 5,
forever: true,
retries: 5,
minTimeout: 30000,
maxTimeout: 60000,
onRetry: logRetry
Expand Down Expand Up @@ -362,10 +361,10 @@ async function initializePubSubListener() {
subscription.on('message', messageHandler);
subscription.on('error', errorHandler);
subscription.on('close', () => { console.error('Subscription closed') });
subscription.detached((cb) => {
console.warn('Subscription detached');
if (cb) {
console.error(cb);
subscription.detached((err, exists) => {
console.log(`Is subscription detached: ${exists}`);
if (err) {
console.error(err);
}
});
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha/src/datasets/dataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function listDatasets(projectId, includeAll) {
console.warn(err);
return { success: false, errors: [err.message] };
});
if (datasets === undefined) {
if (!datasets || datasets === undefined) {
const message = `Datasets do not exist with labelKey: '${labelKey}'`;
return { success: false, code: 400, errors: [message] };
}
Expand Down
4 changes: 3 additions & 1 deletion shared/bigqueryUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const underscore = require("underscore");
class BigQueryUtil {
constructor(projectId) {
this.projectId = projectId;
const options = {};
const options = {
scopes:['https://www.googleapis.com/auth/cloud-platform']
};
if (projectId) {
options.projectId = projectId;
}
Expand Down
Loading

0 comments on commit 102fd13

Please sign in to comment.