Skip to content

Commit

Permalink
Fix for workaround with updated packages
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybell committed Sep 2, 2023
1 parent 299c219 commit 82ad2c0
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions poller/poller-core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,9 @@ function getSpannerMetadata(projectId, spannerInstanceId, units) {
});
}

function postPubSubMessage(spanner, metrics) {
async function postPubSubMessage(spanner, metrics) {
const topic = pubSub.topic(spanner.scalerPubSubTopic);

// Set the publish timeout to its previous default value (10m) to avoid publish errors
topic.setPublishOptions({
gaxOpts: {
timeout: 600000, // Milliseconds
}
});

spanner.metrics = metrics;
const messageBuffer = Buffer.from(JSON.stringify(spanner), 'utf8');

Expand All @@ -224,7 +217,7 @@ function postPubSubMessage(spanner, metrics) {
});
}

function callScalerHTTP(spanner, metrics) {
async function callScalerHTTP(spanner, metrics) {
spanner.scalerURL ||= 'http://scaler';
const url = new URL('/metrics', spanner.scalerURL);

Expand Down Expand Up @@ -367,7 +360,7 @@ forwardMetrics = async (forwarderFunction, spanners) => {
for (const spanner of spanners) {
try {
var metrics = await getMetrics(spanner);
forwarderFunction(spanner, metrics); // Handles exceptions
await forwarderFunction(spanner, metrics); // Handles exceptions
} catch (err) {
log(`Unable to retrieve metrics for ${spanner.projectId}/${spanner.instanceId}`,
{severity: 'ERROR', projectId: spanner.projectId, instanceId: spanner.instanceId, payload: err});
Expand Down

0 comments on commit 82ad2c0

Please sign in to comment.