-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add community indexer #10680
base: master
Are you sure you want to change the base?
Add community indexer #10680
Conversation
@@ -0,0 +1,25 @@ | |||
import { z } from 'zod'; | |||
|
|||
export const CommunityIndexer = z.object({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need a new model for this? Looks like a cache for a retry utils, probably better in redis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's state, but I wouldn't say it's a cache.
There are 50K clanker tokens to initially fetch, so there should be a robust way of tracking it. Also, there will be multiple community indexers in the near future for different sources. For each indexer, it'll fetch many tokens initially, then periodically fetch the newest tokens.
It works pretty much exactly the way the evm listener tracks the last block that it polled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RE: using Redis
After thinking about it more, my main concern there is a lack of enforced typing and migrations. Right now, we just store the watermark and status, but if it ever becomes more sophisticated than that (which there's a good chance it will considering how quickly requirements change), we don't have a framework for migrating the cache– or I guess we'd just destroy the cache and refetch everything, which is going to eventually be 100K+ tokens from clanker + pump.fun– the choice is between being error-prone or inefficient.
Storing in postgres is a bit weird since it's infra state and not model state, but it's the best option for building something robust that handles future needs. The next best thing would be to have a separate PG DB for these things but that's overkill.
Still need to fix the tags and image upload. |
let's wait to merge / deploy this until the other community homepage (product side tickets are merged in) because the communities won't be useful until then |
I have a bunch of conflicts to fix, but the main idea is there. @timolegros before you dig into this– it's worth noting that the clanker API doesn't allow you to jump to a specific ID/timestamp or any sort of watermark. You can jump to an arbitrary page number, but that's useless if you don't know what on those pages. So the implementation reflects that limitation. |
Link to Issue
Closes: #10618
TODO:
Description of Changes
Test Plan
COMMUNITY_INDEXER_CRON='* * * * *'
MAX_CLANKER_BACKFILL=1000
pnpm backfill-clanker-tokens
Deployment Plan
MAX_CLANKER_BACKFILL=0
– will backfill all tokenspnpm backfill-clanker-tokens
script on a new heroku instanceCOMMUNITY_INDEXER_CRON='0 * * * *'
– indexer will trigger every hourOther Considerations
N/A