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: add endpoint to get the total count of transactions for a given period #2074

Merged
merged 7 commits into from
Feb 4, 2025

Conversation

yaboiishere
Copy link
Contributor

resolves: #2054

@yaboiishere yaboiishere self-assigned this Jan 23, 2025

:backward
|> streamer.()
|> Enum.reduce(0, fn index, acc ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Like we've been over before. We should never go through an unlimited list of things, this sooner or later is going to impact performance and is going to cause server downtime. We need to index everything that we query for in the database

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it's a problem here since we have ~3k records and we can also limit the request to be able to scope up to some time

Copy link
Contributor

Choose a reason for hiding this comment

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

This would be the first request that depends on the amount of records stored in the database in order to work properly. I would rather avoid going down that rabbit hole, results should be always immediate, regardless of the amount of records

@@ -622,6 +622,47 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/stats/transactions/total:
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use the existing route we have for counting transactions /transactions/count with a scope param where you scope by generation or time and the existing tx_type filter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That route doesn't allow using scope and tx_type at the same time

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can allow that since it would be the same as what this new route does already

@yaboiishere yaboiishere requested a review from sborrazas January 24, 2025 12:19
@sborrazas sborrazas merged commit 263c3ae into master Feb 4, 2025
7 checks passed
@sborrazas sborrazas deleted the total_txs_count branch February 4, 2025 11:32
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.

Enable transactions count multiple filters
2 participants