Skip to content

Commit

Permalink
fix new tx within tx (#163)
Browse files Browse the repository at this point in the history
Signed-off-by: kim (grufwub) <[email protected]>
  • Loading branch information
NyaaaWhatsUpDoc authored Aug 27, 2021
1 parent 30f688d commit 87328b6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions internal/db/bundb/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ func (s *statusDB) GetStatusByID(ctx context.Context, id string) (*gtsmodel.Stat
Where("status.id = ?", id)

err := processErrorResponse(q.Scan(ctx))

if err != nil {
return nil, err
}
Expand All @@ -145,7 +144,6 @@ func (s *statusDB) GetStatusByURI(ctx context.Context, uri string) (*gtsmodel.St
Where("LOWER(status.uri) = LOWER(?)", uri)

err := processErrorResponse(q.Scan(ctx))

if err != nil {
return nil, err
}
Expand All @@ -168,7 +166,6 @@ func (s *statusDB) GetStatusByURL(ctx context.Context, uri string) (*gtsmodel.St
Where("LOWER(status.url) = LOWER(?)", uri)

err := processErrorResponse(q.Scan(ctx))

if err != nil {
return nil, err
}
Expand Down Expand Up @@ -206,7 +203,7 @@ func (s *statusDB) PutStatus(ctx context.Context, status *gtsmodel.Status) db.Er
for _, a := range status.Attachments {
a.StatusID = status.ID
a.UpdatedAt = time.Now()
if _, err := s.conn.NewUpdate().Model(a).
if _, err := tx.NewUpdate().Model(a).
Where("id = ?", a.ID).
Exec(ctx); err != nil {
return err
Expand Down

0 comments on commit 87328b6

Please sign in to comment.