Skip to content

Commit

Permalink
change rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongFuze committed Nov 10, 2024
1 parent 1ec7da1 commit bc6ce24
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions sns_process/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const db = pg({
},
});

const SOLANA_MAIN_CLIENT = new Connection(process.env.QUICKNODE_RPC);
// const SOLANA_MAIN_CLIENT = new Connection(process.env.QUICKNODE_RPC);
// const SOLANA_MAIN_CLIENT = new Connection(process.env.QUICKNODE_RPC_1);
// const SOLANA_MAIN_CLIENT = new Connection(process.env.SOLANA_RPC);
const SOLANA_MAIN_CLIENT = new Connection(process.env.SOLANA_RPC);

// Set up bottleneck limiter to control request rate (2 requests per second, 30 requests per minute)
// const limiter = new Bottleneck({
Expand All @@ -48,6 +48,14 @@ const SOLANA_MAIN_CLIENT = new Connection(process.env.QUICKNODE_RPC);
// reservoirRefreshInterval: 60 * 1000 // Refresh every minute (60000 ms)
// });

const limiter = new Bottleneck({
minTime: 10000, // 1 request every 10 seconds
maxConcurrent: 1, // Only allow 1 concurrent request at a time
reservoir: 6, // Limit to 30 requests per minute
reservoirRefreshAmount: 6, // Refill 30 tokens
reservoirRefreshInterval: 60 * 1000 // Refresh every minute (60000 ms)
});

// const limiter = new Bottleneck({
// minTime: 100, // 1 request every 100 milliseconds (10 requests per second)
// maxConcurrent: 1, // Only allow 1 concurrent request at a time
Expand All @@ -56,13 +64,13 @@ const SOLANA_MAIN_CLIENT = new Connection(process.env.QUICKNODE_RPC);
// reservoirRefreshInterval: 1000 // Refresh every 1 second (1000 ms)
// });

const limiter = new Bottleneck({
minTime: 200, // 1 request every 200 milliseconds (5 requests per second)
maxConcurrent: 1, // Only allow 1 concurrent request at a time
reservoir: 5, // Limit to 5 requests per second
reservoirRefreshAmount: 5, // Refill 5 tokens (requests)
reservoirRefreshInterval: 1000 // Refresh every 1 second (1000 ms)
});
// const limiter = new Bottleneck({
// minTime: 200, // 1 request every 200 milliseconds (5 requests per second)
// maxConcurrent: 1, // Only allow 1 concurrent request at a time
// reservoir: 5, // Limit to 5 requests per second
// reservoirRefreshAmount: 5, // Refill 5 tokens (requests)
// reservoirRefreshInterval: 1000 // Refresh every 1 second (1000 ms)
// });

// const limiter = new Bottleneck({
// minTime: 500, // 1 request every 500 milliseconds (2 requests per second)
Expand Down Expand Up @@ -548,7 +556,7 @@ async function fetchDomainTextsV2AndUpdate() {
const batchSize = 100;
let allCount = 0;
let batchCount = 0;
let offset = 43500;
let offset = 85000;
let hasMoreRows = true;

while (hasMoreRows) {
Expand Down Expand Up @@ -1129,7 +1137,7 @@ const run = async () => {
};

// Execute the run function
run().catch(console.error);
// run().catch(console.error);

// const domains = await getDomainsWithWallet("HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA")
// console.log(domains);
Expand Down Expand Up @@ -1162,7 +1170,7 @@ run().catch(console.error);

// await retryGetTexts("bonfida")
// await getTextsV2("0xbillys")
// await retryGetTextsV2("uneek")
await retryGetTextsV2("0xbillys")

// await getTwitterReverseLookup("angxze");
// await getTwitterHandle("A8iNaFrXLTBxMPUisDL5jC7i1m9yja9Aq5TK6aCC5DCp");

0 comments on commit bc6ce24

Please sign in to comment.