-
Notifications
You must be signed in to change notification settings - Fork 19
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
(DAL) Latest outgoing data from collector #1781
(DAL) Latest outgoing data from collector #1781
Conversation
Warning Rate limit exceeded@nick-bisonai has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 33 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughWalkthroughThe recent updates streamline data retrieval and handling within the node's package, particularly focusing on submission data and feeds. Functions in the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ApiController
participant Collector
Client->>+ApiController: Request latest feeds
ApiController->>+Collector: GetAllLatestData()
Collector-->>-ApiController: AllLatestData
ApiController-->>-Client: Return latest feeds
Client->>+ApiController: Request latest feed for symbol
ApiController->>+Collector: GetLatestData(symbol)
Collector-->>-ApiController: LatestData(symbol)
ApiController-->>-Client: Return latest feed for symbol
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- node/pkg/dal/api/controller.go (4 hunks)
- node/pkg/dal/collector/collector.go (5 hunks)
- node/pkg/dal/tests/api_test.go (7 hunks)
Additional comments not posted (9)
node/pkg/dal/api/controller.go (2)
163-165
: LGTM! Verify the correctness ofGetAllLatestData
.The function now uses
ApiController.Collector.GetAllLatestData()
to retrieve data, which aligns with the updated process to improve response time.Ensure that
GetAllLatestData
is correctly implemented and tested.Verification successful
The implementation of
GetAllLatestData
is correct.
- The method is implemented in
node/pkg/dal/collector/collector.go
and correctly retrieves all latest data fromc.LatestData
.- The usage in your code snippet is appropriate.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `GetAllLatestData` method in `Collector`. # Test: Search for the implementation and references of `GetAllLatestData`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_ *Collector) GetAllLatestData() []dalcommon.OutgoingSubmissionData { $$$ }' rg --type go -A 5 $'GetAllLatestData()'Length of output: 1826
188-193
: LGTM! Verify the correctness ofGetLatestData
.The function now uses
ApiController.Collector.GetLatestData(symbol)
to retrieve data, which aligns with the updated process to improve response time.Ensure that
GetLatestData
is correctly implemented and tested.Verification successful
Let's fix the ripgrep command and re-run it to gather more context about the usage of
GetLatestData
.
Let's fix the ripgrep command by avoiding special regex characters and re-run it to gather more context about the usage of
GetLatestData
.
LGTM!
The
GetLatestData
method inCollector
is correctly implemented and used appropriately inApiController
.
- The function handles data retrieval and error conditions properly.
- The usage in
controller.go
aligns with the expected behavior.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `GetLatestData` method in `Collector`. # Test: Search for the implementation and references of `GetLatestData`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_ *Collector) GetLatestData(symbol string) (*dalcommon.OutgoingSubmissionData, error) { $$$ }' rg --type go -A 5 $'GetLatestData('Length of output: 1128
Script:
#!/bin/bash # Description: Verify the correctness of `GetLatestData` method in `Collector`. # Test: Search for the implementation and references of `GetLatestData`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_ *Collector) GetLatestData(symbol string) (*dalcommon.OutgoingSubmissionData, error) { $$$ }' rg --type go -A 5 'GetLatestData('Length of output: 1128
Script:
#!/bin/bash # Description: Verify the correctness of `GetLatestData` method in `Collector`. # Test: Search for the implementation and references of `GetLatestData`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_ *Collector) GetLatestData(symbol string) (*dalcommon.OutgoingSubmissionData, error) { $$$ }' rg --type go -A 5 'GetLatestData'Length of output: 1765
node/pkg/dal/tests/api_test.go (2)
139-143
: LGTM! Verify the correctness oftestPublishData
.The test case now uses
testPublishData
to publish sample submission data, which aligns with the updated data handling methods.Ensure that
testPublishData
is correctly implemented and tested.Verification successful
Verification successful!
The
testPublishData
function is correctly implemented and consistently used across different test files to publish sample submission data.
Implementation found in
node/pkg/dal/tests/main_test.go
:func testPublishData(ctx context.Context, submissionData aggregator.SubmissionData) error { return db.Publish(ctx, keys.SubmissionDataStreamKey(submissionData.GlobalAggregate.ConfigID), submissionData) }Usage found in:
node/pkg/dal/tests/api_test.go
node/pkg/dal/tests/collector_test.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `testPublishData` function. # Test: Search for the implementation and references of `testPublishData`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func testPublishData($_, $_) error { $$$ }' rg --type go -A 5 'testPublishData'Length of output: 2445
62-66
: LGTM! Verify the correctness oftestPublishData
.The test case now uses
testPublishData
to publish sample submission data, which aligns with the updated data handling methods.Ensure that
testPublishData
is correctly implemented and tested.Verification successful
LGTM! Verify the correctness of
db.Publish
.The
testPublishData
function is correctly implemented and aligns with the updated data handling methods. Now, ensure thatdb.Publish
is correctly implemented and handles the passed parameters properly.
LGTM! Verify the correctness of
db.Publish
.Correct the
rg
command and ensure that the method signature pattern is accurate to find the implementation and references ofdb.Publish
.
Verified: The
testPublishData
method and its usage are correct. Thedb.Publish
method is implemented with necessary checks and is well-tested.
- Implementation and references of
testPublishData
innode/pkg/dal/tests/main_test.go
and other files are correct.db.Publish
method innode/pkg/db/redis.go
is correctly implemented and includes parameter checks.- Multiple test cases in
node/pkg/db/redis_test.go
confirm the robustness ofdb.Publish
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `testPublishData` function. # Test: Search for the implementation and references of `testPublishData`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func testPublishData($_, $_) error { $$$ }' rg --type go -A 5 'testPublishData'Length of output: 2445
Script:
#!/bin/bash # Description: Verify the correctness of the `db.Publish` method. # Test: Search for the implementation and references of `db.Publish`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_).Publish($_, $_, $_) error { $$$ }' rg --type go -A 5 'Publish('Length of output: 174
Script:
#!/bin/bash # Description: Verify the correctness of the `db.Publish` method. # Test: Search for the implementation and references of `db.Publish`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_).Publish($_, $_, $_) error { $$$ }' rg --type go -A 5 'Publish\('Length of output: 4698
node/pkg/dal/collector/collector.go (5)
71-71
: LGTM! Verify the correctness ofLatestData
initialization.The
LatestData
field is correctly initialized in theCollector
struct.Ensure that
LatestData
is correctly initialized and used.Verification successful
Verified: Initialization and Usage of
LatestData
are Correct
- The
LatestData
field in theCollector
struct is correctly initialized assync.Map{}
.- The usage of
LatestData
in methods likeGetLatestData
,GetAllLatestData
, andStore
is consistent and appropriate.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `LatestData` initialization and usage. # Test: Search for the initialization and references of `LatestData`. Expect: Correct initialization and usage. ast-grep --lang go --pattern 'LatestData: $_' rg --type go -A 5 'LatestData'Length of output: 6237
230-232
: LGTM! Verify the correctness ofstoreLatest
.The method stores the latest data in
LatestData
, which aligns with the updated process to improve response time.Ensure that
storeLatest
is correctly implemented and tested.Verification successful
Verified: The
storeLatest
method is correctly implemented and used.The
storeLatest
method is properly implemented and invoked within thecollector.go
file, ensuring that the latest data is stored as intended.
- Implementation found at
node/pkg/dal/collector/collector.go:230-232
.- Usage found at
node/pkg/dal/collector/collector.go: defer c.storeLatest(result)
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `storeLatest` method in `Collector`. # Test: Search for the implementation and references of `storeLatest`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_ *Collector) storeLatest(data *dalcommon.OutgoingSubmissionData) { $$$ }' rg --type go -A 5 $'storeLatest('Length of output: 464
Script:
#!/bin/bash # Description: Verify the correctness of `storeLatest` method in `Collector`. # Test: Search for the implementation and references of `storeLatest`. Expect: Correct implementation and usage. # Corrected rg command to avoid regex parse error rg --type go 'storeLatest\(' -A 5Length of output: 728
102-114
: LGTM! Verify the correctness ofGetLatestData
.The method retrieves the latest data for a given symbol from
LatestData
, which aligns with the updated process to improve response time.Ensure that
GetLatestData
is correctly implemented and tested.Verification successful
Verified: The
GetLatestData
method is correctly implemented and used.
- Implementation found in
node/pkg/dal/collector/collector.go
- Usage reference found in
node/pkg/dal/api/controller.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `GetLatestData` method in `Collector`. # Test: Search for the implementation and references of `GetLatestData`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_ *Collector) GetLatestData(symbol string) (*dalcommon.OutgoingSubmissionData, error) { $$$ }' rg --type go -A 5 $'GetLatestData('Length of output: 1128
Script:
#!/bin/bash # Description: Verify the correctness of `GetLatestData` method in `Collector`. # Test: Search for the implementation and references of `GetLatestData`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_ *Collector) GetLatestData(symbol string) (*dalcommon.OutgoingSubmissionData, error) { $$$ }' # Correcting the regex pattern for `rg` to search for references to `GetLatestData`. rg --type go -A 5 'GetLatestData('Length of output: 1128
Script:
#!/bin/bash # Description: Verify the correctness of `GetLatestData` method in `Collector`. # Test: Search for the implementation and references of `GetLatestData`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_ *Collector) GetLatestData(symbol string) (*dalcommon.OutgoingSubmissionData, error) { $$$ }' # Correcting the regex pattern for `rg` to search for references to `GetLatestData`. rg --type go -A 5 'GetLatestData\('Length of output: 1769
167-167
: LGTM! Verify the correctness ofstoreLatest
.The method now calls
storeLatest
to store the latest data, which aligns with the updated process to improve response time.Ensure that
storeLatest
is correctly implemented and tested.Verification successful
The implementation and usage of
storeLatest
are correct.
- The method
storeLatest
is properly defined and used withinnode/pkg/dal/collector/collector.go
.- The
LatestData
is correctly defined as async.Map
and used appropriately.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `storeLatest` method in `Collector`. # Test: Search for the implementation and references of `storeLatest`. Expect: Correct implementation and usage. ast-grep --lang go --pattern 'func ($_ *Collector) storeLatest(data *dalcommon.OutgoingSubmissionData) { $$$ }' rg --type go -A 5 $'storeLatest('Length of output: 464
Script:
#!/bin/bash # Description: Verify the definition and usage of `LatestData` and correct the rg command to find all references to `storeLatest`. # Test 1: Search for the definition of `LatestData`. rg --type go 'LatestData' # Test 2: Correct and run the `rg` command to find all references to `storeLatest`. rg --type go 'storeLatest('Length of output: 1843
Script:
#!/bin/bash # Description: Correct the `rg` command to find all references to `storeLatest`. # Test: Correct and run the `rg` command to find all references to `storeLatest`. rg --type go 'storeLatest\('Length of output: 205
116-127
: LGTM! Verify the correctness ofGetAllLatestData
.The method retrieves all the latest data from
LatestData
, which aligns with the updated process to improve response time.Ensure that
GetAllLatestData
is correctly implemented and tested.
c61c9a9
to
a9a64c8
Compare
Description
based on local test, this updates rest api response time from
200ms -> less than 10ms
AS - IS
rest api
TO - BE
Type of change
Please delete options that are not relevant.
Checklist before requesting a review
Deployment