Skip to content

Commit

Permalink
store tier
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTrunk committed Sep 8, 2021
1 parent 2347e57 commit 70abb4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions ZelBack/src/services/appsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const myCache = new LRU(LRUoptions);

let removalInProgress = false;
let installationInProgress = false;
let storedTier = '';

function getAppIdentifier(appName) {
// this id is used for volumes, docker names so we know it reall belongs to flux
Expand Down Expand Up @@ -357,6 +358,9 @@ async function listAppsImages(req, res) {
}

async function nodeTier() {
if (storedTier) {
return storedTier; // node tier is not changing. We can use globally cached value.
}
// get our collateral information to decide if app specifications are basic, super, bamf
// getzlenodestatus.collateral
const nodeStatus = await daemonService.getZelNodeStatus();
Expand All @@ -378,13 +382,16 @@ async function nodeTier() {
// get collateralInformation.txindex vout
const { value } = txInformation.data.vout[collateralInformation.txindex];
if (value === 10000) {
return 'basic';
storedTier = 'basic';
return storedTier;
}
if (value === 25000) {
return 'super';
storedTier = 'super';
return storedTier;
}
if (value === 100000) {
return 'bamf';
storedTier = 'bamf';
return storedTier;
}
throw new Error('Unrecognised Flux Node tier');
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flux",
"version": "2.0.2",
"version": "2.0.3",
"description": "Flux, Your Gateway to a Decentralized World",
"repository": {
"type": "git",
Expand Down

0 comments on commit 70abb4d

Please sign in to comment.