-
Notifications
You must be signed in to change notification settings - Fork 304
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: introducing warehouse repo withTx #4042
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #4042 +/- ##
==========================================
+ Coverage 71.52% 71.55% +0.02%
==========================================
Files 373 373
Lines 54838 54827 -11
==========================================
+ Hits 39224 39231 +7
+ Misses 13275 13263 -12
+ Partials 2339 2333 -6
☔ View full report in Codecov by Sentry. |
a80770f
to
b8b59f0
Compare
|
||
if err := f(tx); err != nil { | ||
if rollbackErr := tx.Rollback(); rollbackErr != nil { | ||
return fmt.Errorf("rollback transaction for %w: %w", err, rollbackErr) |
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 is like a Nando's double 🐔 wrap but with errors 😅
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 am a bit skeptical here. Should we ignore rollback error?
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.
Nah, it's OK. It works perfectly fine and it is possible to unwrap both errors 👍
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 wasn't aware that is possible to wrap two errors that the same time, cool
d167bf2
to
7d12055
Compare
defer func() { _ = stmt.Close() }() | ||
|
||
for _, loadFile := range loadFiles { | ||
metadata := fmt.Sprintf(`{"content_length": %d, "destination_revision_id": %q, "use_rudder_storage": %t}`, loadFile.ContentLength, loadFile.DestinationRevisionID, loadFile.UseRudderStorage) |
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.
[minor] I would prefer a proper json.Marshal()
, IMO is cleaner and safer
|
||
if err := f(tx); err != nil { | ||
if rollbackErr := tx.Rollback(); rollbackErr != nil { | ||
return fmt.Errorf("rollback transaction for %w: %w", err, rollbackErr) |
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 wasn't aware that is possible to wrap two errors that the same time, cool
Description
WithTx
to use wherever transactions are used.WithTx
is required during reporting where we update fields and report to reporting in the same transaction.Linear Ticket
Security