-
Notifications
You must be signed in to change notification settings - Fork 2
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
#feat Switch to PostgreSQL #70
base: main
Are you sure you want to change the base?
Conversation
3fdff9a
to
42b3a8e
Compare
b5f0547
to
96913ef
Compare
change: number; | ||
place: number; | ||
}>( | ||
'SELECT (points + points_l1 + points_l2)::int as points, change::int as change, place::int as place FROM user_points_public WHERE address = $1 LIMIT 1', |
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 may fail due to overflow (points + points_l1 + points_l2)::int
here
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.
Good catch, changed to ::bigint
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.
why can't we use numeric/decimal?
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.
Now using numeric and changed response type to string
crawler/index.ts
Outdated
); | ||
const insert = db.transaction((balances) => { | ||
async (balances: UserBalance[]) => { | ||
const callbackDbClient = await connect(false, config, logger); |
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.
this can lead to pool exhaustion, please make sure connection pool size is like around 20-30 or so
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.
Using a connection pool with 30 connections now
const client = new Client({ | ||
host: 'localhost', | ||
port: 5432, | ||
database: 'crawler', | ||
user: 'admin', | ||
password: 'password', | ||
}); |
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.
is this one for testing?
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.
Yes, I tried to support test scripts in /db directory. If we dont need them for now, I can remove them from the repo
e957b46
to
93466f9
Compare
4be0902
to
e5307da
Compare
No description provided.