Skip to content

Commit

Permalink
feat(BRIDGE-206): refactored; added missing stuff; TODO rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroNafta committed Oct 2, 2024
1 parent e19bae3 commit 3bbeea9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion internal/db_impl/sqlite3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,12 @@ func (c *Client) wrapTx(ctx context.Context, op func(context.Context, *sql.Tx, *
}

if err := tx.Commit(); err != nil {
if !errors.Is(err, context.Canceled) {
observability.AddOtherMetric(ctx, metrics.GenerateFailedToCommitDatabaseTransactionMetric())
}

if c.debug {
entry.Debugf("Failed to commit Transaction")
observability.AddOtherMetric(ctx, metrics.GenerateFailedToCommitDatabaseTransactionMetric())
}

return fmt.Errorf("%v: %w", err, db.ErrTransactionFailed)
Expand Down
1 change: 0 additions & 1 deletion internal/state/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ func (state *State) actionCreateMessage(
}
if knownErr == nil {
if cameFromDrafts {
// TODO save the data from Sentry
observability.AddOtherMetric(ctx, metrics.GenerateAppendToDraftsMustNotReturnExistingRemoteID())
state.log.Errorf("Append to drafts must not return an existing RemoteID (Remote=%v, Internal=%v)", res.ID, knownInternalID)

Expand Down
1 change: 1 addition & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func (s *Server) AddUser(ctx context.Context, conn connector.Connector, passphra
// LoadUser adds an existing user using a previously crated unique user ID.
// It returns true if the user was newly created, false if it already existed.
func (s *Server) LoadUser(ctx context.Context, conn connector.Connector, userID string, passphrase []byte) (bool, error) {
ctx = observability.NewContextWithObservabilitySender(ctx, s.observabilitySender)
ctx = reporter.NewContextWithReporter(ctx, s.reporter)

isNew, err := s.backend.AddUser(ctx, userID, conn, passphrase, s.uidValidityGenerator)
Expand Down

0 comments on commit 3bbeea9

Please sign in to comment.