Skip to content

Commit

Permalink
format and more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mschneider committed Aug 7, 2024
1 parent 0afee18 commit 94f4331
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions ts/client/scripts/sb-on-demand-crank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ async function setupBackgroundRefresh(

const startedAt = Date.now();
const [block, slot] = await Promise.all([
// use finalized blockhash for faster timeouts on transactions
client.connection.getLatestBlockhash('finalized'),
// use processed slot for accurate staleness measurement
client.connection.getSlot('processed'),
]);

Expand Down Expand Up @@ -269,7 +271,7 @@ async function setupBackgroundRefresh(
`[tx send] https://solscan.io/tx/${data['txid']}, in ${total}s, lamportsPerCu_ ${lamportsPerCu_}, lamportsPerCu ${lamportsPerCu}, timiming ${JSON.stringify(timing)}`,
);
},
onError: function (e, notProcessedTransactions, _originalProps) {
onError: function (e, notProcessedTransactions) {
console.error(
`[tx send] ${notProcessedTransactions.length} error(s) after ${(Date.now() - ixPreparedAt) / 1000}s ${JSON.stringify(e)}`,
);
Expand Down Expand Up @@ -308,7 +310,7 @@ async function preparePullIx(
gateway: oracle.gatewayUrl,
};
// TODO use fetchUpdateMany
const [pullIx, _responses, _success] = await pullFeed.fetchUpdateIx(
const [pullIx] = await pullFeed.fetchUpdateIx(
conf,
recentSlothashes,
);
Expand Down Expand Up @@ -373,7 +375,8 @@ async function filterForStaleOracles(
// maxStaleness will usually be 250 (=100s)
// one iteration takes 10s, retry is every 20s
// this allows for 2 retries until the oracle becomes stale
diff > item.decodedPullFeed.maxStaleness * 0.3
diff >
item.decodedPullFeed.maxStaleness * 0.3
) {
console.log(
`[filter stale] ${item.oracle.name}, candidate, ${item.decodedPullFeed.maxStaleness}, ${slot}, ${res.lastUpdatedSlot}, ${diff}`,
Expand Down
2 changes: 1 addition & 1 deletion ts/client/src/accounts/healthCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ export class HealthCache {
// - be careful about finding the minFnValue: the function isn't convex

const initialRatio = this.healthRatio(HealthType.init);

Check failure on line 951 in ts/client/src/accounts/healthCache.ts

View workflow job for this annotation

GitHub Actions / Lint

'initialRatio' is assigned a value but never used
// eslint-disable-next-line @typescript-eslint/no-unused-vars

const healthCacheClone: HealthCache = deepClone<HealthCache>(this);
const sourceIndex = healthCacheClone.getOrCreateTokenInfoIndex(sourceBank);
Expand Down

0 comments on commit 94f4331

Please sign in to comment.