-
Notifications
You must be signed in to change notification settings - Fork 11
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
Conversation
lib/ae_mdw/stats.ex
Outdated
|
||
:backward | ||
|> streamer.() | ||
|> Enum.reduce(0, fn index, acc -> |
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.
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
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.
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
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 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: |
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.
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
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.
That route doesn't allow using scope and tx_type at the same time
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.
Maybe we can allow that since it would be the same as what this new route does already
resolves: #2054