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(warehouse): warehouse api to capture task run ID when calculating the pending uploads. #2435

Merged
merged 3 commits into from Sep 21, 2022

Conversation

abhimanyubabbar
Copy link
Contributor

Description

For sources to know that the task run has no transient uploads in the system, we need to capture the task run id in the endpoint and then call the pendingUploadCount with this filterBy clause.

Notion Ticket

https://www.notion.so/rudderstacks/Warehouse-Pending-Events-API-a3e22ec2834c427fa3a7b8ed02c8e63e

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@codecov
Copy link

codecov bot commented Sep 13, 2022

Codecov Report

Merging #2435 (7afe7b1) into master (44f3786) will increase coverage by 0.05%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #2435      +/-   ##
==========================================
+ Coverage   36.15%   36.21%   +0.05%     
==========================================
  Files         200      200              
  Lines       39644    39676      +32     
==========================================
+ Hits        14335    14368      +33     
+ Misses      24407    24404       -3     
- Partials      902      904       +2     
Impacted Files Coverage Δ
warehouse/api.go 0.00% <0.00%> (ø)
warehouse/utils/utils.go 60.78% <ø> (ø)
warehouse/warehouse.go 3.13% <0.00%> (-0.03%) ⬇️
config/backend-config/namespace_config.go 76.33% <0.00%> (-2.30%) ⬇️
router/internal/eventorder/eventorder.go 95.97% <0.00%> (-1.09%) ⬇️
router/router.go 67.59% <0.00%> (+0.11%) ⬆️
processor/processor.go 72.42% <0.00%> (+0.82%) ⬆️
utils/httputil/server.go 92.30% <0.00%> (+11.53%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@abhimanyubabbar abhimanyubabbar marked this pull request as ready for review September 14, 2022 05:04
@abhimanyubabbar abhimanyubabbar changed the title Pending Events to capture Task Run ID when calculating the pending uploads in warehouse system. chore(warehouse): warehouse api to capture task run ID when calculating the pending uploads. Sep 14, 2022
warehouse/warehouse.go Show resolved Hide resolved
@@ -1361,6 +1361,11 @@ func pendingEventsHandler(w http.ResponseWriter, r *http.Request) {
// TODO : respond with errors in a common way
pkgLogger.LogRequest(r)

if r.Method != "POST" {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using this can we move this to the server mutex?
mux := mux.NewRouter()
mux.HandleFunc("/v1/warehouse/pending-events", pendingEventsHandler).Methods("POST")

Copy link
Member

Choose a reason for hiding this comment

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

We would not need this right.

warehouse/warehouse.go Show resolved Hide resolved
@@ -1678,7 +1691,7 @@ func startWebHandler(ctx context.Context) error {
backendconfig.DefaultBackendConfig.WaitForConfig(ctx)
mux.HandleFunc("/v1/process", processHandler)
// triggers uploads only when there are pending events and triggerUpload is sent for a sourceId
mux.HandleFunc("/v1/warehouse/pending-events", pendingEventsHandler)
mux.HandleFunc("/v1/warehouse/pending-events", pendingEventsHandler).Methods("GET")
Copy link
Member

Choose a reason for hiding this comment

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

We don't have a Methods function for ServerMux. We would need to convert it to Router.

mux := mux.NewRouter()
mux.HandleFunc("/v1/warehouse/pending-events", pendingEventsHandler).Methods("POST")

@@ -1361,6 +1361,11 @@ func pendingEventsHandler(w http.ResponseWriter, r *http.Request) {
// TODO : respond with errors in a common way
pkgLogger.LogRequest(r)

if r.Method != "POST" {
Copy link
Member

Choose a reason for hiding this comment

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

We would not need this right.

@abhimanyubabbar abhimanyubabbar merged commit d43705e into master Sep 21, 2022
@github-actions github-actions bot deleted the chore.augment-pending-events branch November 15, 2022 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants