Skip to content

fix: clean up async destination struct after upload is finished - #5975

Merged
koladilip merged 1 commit into
masterfrom
fix.async-destinations-delivery-metrics
Jun 13, 2025
Merged

koladilip merged 1 commit into
masterfrom
fix.async-destinations-delivery-metrics

Conversation

@koladilip

@koladilip koladilip commented Jun 10, 2025 •

Copy link
Copy Markdown
Contributor

Description

The PR fixes the logic for cleaning up the async upload state in the batch router.
Previously, the cleanup (asyncStructCleanUp) was being called unconditionally after each upload attempt, regardless of whether the upload iteration was actually completed.
Now, the cleanup is only performed if the upload iteration is truly completed (i.e., when there are no more jobs left to import for that destination).
The UploadInProgress flag is now set to true only when there are jobs still being imported; otherwise, cleanup is performed.
Additionally, the UploadInProgress flag is explicitly reset to false inside the asyncStructCleanUp function to ensure the state is always consistent after cleanup.

Key Code Changes:
In pollAsyncStatus, the unconditional setting of UploadInProgress = false was removed, and cleanup is now only called after a successful update.
In asyncUploadWorker, the logic for calling asyncStructCleanUp was moved inside an else block, so it only happens when there are no more jobs to import.
The UploadInProgress flag is now reset to false in asyncStructCleanUp.

Impact:
This change ensures that the async upload state is only cleaned up when an upload iteration is truly finished, preventing premature cleanup and potential issues with job processing state.

Linear Ticket

https://linear.app/rudderstack/issue/INT-3807/fix-cleaning-up-async-destination-struct
Resolves INT-3807

Security

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

@koladilip koladilip changed the title Fix.async-destinations-delivery-metrics fix: update and extend async event delivery time metrics tests for JobParameters logic Jun 10, 2025
@koladilip
koladilip enabled auto-merge (squash) June 10, 2025 12:13
@koladilip
koladilip requested a review from atzoum June 10, 2025 13:18
@koladilip
koladilip force-pushed the fix.async-destinations-delivery-metrics branch 2 times, most recently from 0519d94 to 5d19c99 Compare June 10, 2025 13:46
@koladilip koladilip changed the title fix: update and extend async event delivery time metrics tests for JobParameters logic fix: clean up async destination struct after upload is finished Jun 11, 2025
@koladilip
koladilip changed the base branch from release/1.51.x to master June 11, 2025 06:54
@koladilip
koladilip force-pushed the fix.async-destinations-delivery-metrics branch from 5d19c99 to d2ac5af Compare June 11, 2025 06:56
@rudderlabs rudderlabs deleted a comment from codecov Bot Jun 11, 2025
@codecov

codecov Bot commented Jun 11, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.87%. Comparing base (e4abe53) to head (6be55d0).
Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5975      +/-   ##
==========================================
+ Coverage   76.80%   76.87%   +0.07%     
==========================================
  Files         495      495              
  Lines       68490    68524      +34     
==========================================
+ Hits        52603    52678      +75     
+ Misses      13011    12982      -29     
+ Partials     2876     2864      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@koladilip
koladilip force-pushed the fix.async-destinations-delivery-metrics branch from d2ac5af to 6be55d0 Compare June 11, 2025 09:51
@koladilip
koladilip merged commit 01483d5 into master Jun 13, 2025
@koladilip
koladilip deleted the fix.async-destinations-delivery-metrics branch June 13, 2025 08:59
This was referenced Jun 16, 2025
itsmihir pushed a commit that referenced this pull request Jun 16, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.52.0-rc.1](v1.51.0...v1.52.0-rc.1)
(2025-06-16)


### Features

* capture bot metrics post deduplication
([#5956](#5956))
([94f40c8](94f40c8))
* detect and handle memory-fenced responses in rudder-server
([#5935](#5935))
([af45808](af45808))
* migrate cloud destinations to v2 sdk
([#5916](#5916))
([93d64f5](93d64f5))
* shutdown server on non-reloadable config change
([#5941](#5941))
([985d3f9](985d3f9))


### Bug Fixes

* duplicates in snowpipe streaming due to stale channel cache
([#5957](#5957))
([4badd49](4badd49))
* gcs file deletion timing out
([#5951](#5951))
([e4abe53](e4abe53))
* update and extend async event delivery time metrics tests for
JobParameters logic
([#5975](#5975))
([01483d5](01483d5))
* warehouse transformations deep copying arguments
([#5979](#5979))
([28d15ac](28d15ac))


### Miscellaneous

* add conversionTime iso 8601 validation for bingads oc
([#5858](#5858))
([3e0dc6f](3e0dc6f))
* create new backoff on every reporting request
([#5993](#5993))
([7e3715a](7e3715a))
* **deps:** bump the go-deps group across 1 directory with 21 updates
([#5983](#5983))
([aa3ee66](aa3ee66))
* remove golang.org/x/crypto v0.32.0
([#5986](#5986))
([6fbb5a3](6fbb5a3))
* sync release v1.51.0 to main branch
([#5971](#5971))
([b9b1a21](b9b1a21))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
itsmihir pushed a commit that referenced this pull request Jun 17, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.52.0](v1.51.0...v1.52.0)
(2025-06-16)


### Features

* capture bot metrics post deduplication
([#5956](#5956))
([94f40c8](94f40c8))
* detect and handle memory-fenced responses in rudder-server
([#5935](#5935))
([af45808](af45808))
* migrate cloud destinations to v2 sdk
([#5916](#5916))
([93d64f5](93d64f5))
* shutdown server on non-reloadable config change
([#5941](#5941))
([985d3f9](985d3f9))


### Bug Fixes

* duplicates in snowpipe streaming due to stale channel cache
([#5957](#5957))
([4badd49](4badd49))
* gcs file deletion timing out
([#5951](#5951))
([e4abe53](e4abe53))
* update and extend async event delivery time metrics tests for
JobParameters logic
([#5975](#5975))
([01483d5](01483d5))
* warehouse transformations deep copying arguments
([#5979](#5979))
([28d15ac](28d15ac))


### Miscellaneous

* add conversionTime iso 8601 validation for bingads oc
([#5858](#5858))
([3e0dc6f](3e0dc6f))
* create new backoff on every reporting request
([#5993](#5993))
([7e3715a](7e3715a))
* **deps:** bump the go-deps group across 1 directory with 21 updates
([#5983](#5983))
([aa3ee66](aa3ee66))
* remove golang.org/x/crypto v0.32.0
([#5986](#5986))
([6fbb5a3](6fbb5a3))
* sync release v1.51.0 to main branch
([#5971](#5971))
([b9b1a21](b9b1a21))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
This was referenced Jun 23, 2025
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