Skip to content

Commit 75abeb1

Browse files
authored
[price-service] Add minSymbols check to liveness (#882)
1 parent 211bf02 commit 75abeb1

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

price_service/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/price-service-server",
3-
"version": "3.0.6",
3+
"version": "3.0.7",
44
"description": "Webservice for retrieving prices from the Pyth oracle.",
55
"private": "true",
66
"main": "index.js",

price_service/server/src/rest.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ export class RestAPI {
525525
app.get("/live", (_, res: Response) => {
526526
const threshold = 60;
527527
const stalePriceTreshold = 10;
528+
const minimumNumPrices = 100;
528529

529530
const currentTime: TimestampInSec = Math.floor(Date.now() / 1000);
530531

@@ -540,7 +541,10 @@ export class RestAPI {
540541
}
541542
}
542543

543-
if (stalePriceCnt > stalePriceTreshold) {
544+
if (
545+
priceIds.length < minimumNumPrices ||
546+
stalePriceCnt > stalePriceTreshold
547+
) {
544548
res.sendStatus(StatusCodes.SERVICE_UNAVAILABLE);
545549
} else {
546550
res.sendStatus(StatusCodes.OK);

0 commit comments

Comments
 (0)