Skip to content
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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

deniszagumennov
Copy link
Contributor

No description provided.

@deniszagumennov deniszagumennov force-pushed the feat/postgresql_switch branch 2 times, most recently from 3fdff9a to 42b3a8e Compare November 25, 2024 19:53
@deniszagumennov deniszagumennov marked this pull request as ready for review November 26, 2024 12:28
@deniszagumennov deniszagumennov changed the title Switch to PostgreSQL #feat Switch to PostgreSQL Nov 26, 2024
@deniszagumennov deniszagumennov force-pushed the feat/postgresql_switch branch 2 times, most recently from b5f0547 to 96913ef Compare November 27, 2024 21:29
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',
Copy link
Collaborator

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

Copy link
Contributor Author

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

Copy link
Collaborator

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?

Copy link
Contributor Author

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);
Copy link
Collaborator

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

Copy link
Contributor Author

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

Comment on lines +5 to +11
const client = new Client({
host: 'localhost',
port: 5432,
database: 'crawler',
user: 'admin',
password: 'password',
});
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants