Skip to content

Commit

Permalink
[!] re-run twitter handle
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongFuze committed Nov 7, 2024
1 parent e763f0a commit 03e1d73
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions sns_process/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,13 @@ async function fetchTwitterHandlesAndUpdate() {
let batchCount = 0;
let offset = 0;
let hasMoreRows = true;
// Use a Set to filter out duplicate owners
const processedOwners = new Set();

while (hasMoreRows) {
// Fetch 100 distinct owners from the database
const query = `
SELECT DISTINCT ON (owner) owner
SELECT owner
FROM sns_profile
WHERE owner IS NOT NULL AND owner != '11111111111111111111111111111111'
LIMIT $1 OFFSET $2`;
Expand All @@ -432,7 +434,12 @@ async function fetchTwitterHandlesAndUpdate() {
if (batch.length > 0) {
for (const wallet of batch) {
const owner = wallet.owner;
if (processedOwners.has(owner)) {
console.log(`processedOwners Ignore Owner(${owner}) has already been fetched`);
continue;
}
const twitterHandle = await retryGetTwitterHandle(owner);
console.log(twitterHandle)
if (twitterHandle) {
hasTwitterCount += 1;
allCount++;
Expand Down Expand Up @@ -972,9 +979,9 @@ const run = async () => {
// await fetchDomainsAndUpsert();
// await fetchDomainsByOwnersAndUpsert();
// await fetchPrimaryDomainsAndUpdate();
// await fetchTwitterHandlesAndUpdate();
await fetchTwitterHandlesAndUpdate();
// await fetchDomainTextsAndUpdate();
await fetchTwitterLookupAndUpdate();
// await fetchTwitterLookupAndUpdate();
};

// Execute the run function
Expand Down Expand Up @@ -1013,4 +1020,5 @@ run().catch(console.error);
// await getTexts("vaxa")
// await getTexts("komacash")

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

0 comments on commit 03e1d73

Please sign in to comment.