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

chore: improve performance store attestation #1596

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

migmartri
Copy link
Member

@migmartri migmartri commented Nov 26, 2024

There were a couple of issues with storing attestations

  • The go-routine was leaving some open connections, this was a regression introduced a couple of days ago.
  • But these open connections were happening because of the referrer storage logic that was runnign a very long transaction. This code removes the transaction and simplifies the code.

before we were getting this

SELECT count(*) as total, usename AS username, state, query FROM pg_stat_activity where state = 'idle in transaction' group by (username, state, query);
 total | username  |        state        | query
-------+-----------+---------------------+-------
    50 | chainloop | idle in transaction | begin

refs #1533

Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
@migmartri migmartri requested review from jiparis and javirln November 26, 2024 15:06
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
@migmartri migmartri merged commit ef1ab45 into chainloop-dev:main Nov 26, 2024
1 check passed
@migmartri migmartri deleted the backend branch November 26, 2024 15:14
max_open_conns: 5
min_open_conns: 1
max_conn_idle_time: 120s
# max_open_conns: 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an accidental change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really, I uncommented it so we can reproduce locally the issues, and in the end I left it like this. Do you think we should remove it?

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.

3 participants