fork of indigo with slightly nicer lexgen

Small cleanup for relay host code (#1060)

Minor changes:

1. Removes duplicate WithContext() call
2. Uses `First()` instead of `Find()` where only one struct is expected

authored by bnewbold.net and committed by GitHub 8aa64b2a 7ea3ed5e

Changed files
+2 -2
cmd
relay
relay
+2 -2
cmd/relay/relay/host.go
··· 38 defer span.End() 39 40 var host models.Host 41 - if err := r.db.WithContext(ctx).Find(&host, hostID).Error; err != nil { 42 if errors.Is(err, gorm.ErrRecordNotFound) { 43 return nil, ErrHostNotFound 44 } ··· 125 // 126 // Note that in some situations this may have partial success. 127 func (r *Relay) PersistHostCursors(ctx context.Context, cursors *[]HostCursor) error { 128 - tx := r.db.WithContext(ctx).WithContext(ctx).Begin() 129 for _, cur := range *cursors { 130 if cur.LastSeq <= 0 { 131 continue
··· 38 defer span.End() 39 40 var host models.Host 41 + if err := r.db.WithContext(ctx).First(&host, hostID).Error; err != nil { 42 if errors.Is(err, gorm.ErrRecordNotFound) { 43 return nil, ErrHostNotFound 44 } ··· 125 // 126 // Note that in some situations this may have partial success. 127 func (r *Relay) PersistHostCursors(ctx context.Context, cursors *[]HostCursor) error { 128 + tx := r.db.WithContext(ctx).Begin() 129 for _, cur := range *cursors { 130 if cur.LastSeq <= 0 { 131 continue