mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(downloadclient): could not delete (#1020)
* fix(downloadclient): could not delete client * fix(downloadclient): postgres fix tx options
This commit is contained in:
parent
6c2f3a4b2b
commit
1637c6209d
1 changed files with 6 additions and 1 deletions
|
@ -257,7 +257,7 @@ func (r *DownloadClientRepo) Update(ctx context.Context, client domain.DownloadC
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *DownloadClientRepo) Delete(ctx context.Context, clientID int) error {
|
func (r *DownloadClientRepo) Delete(ctx context.Context, clientID int) error {
|
||||||
tx, err := r.db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelWriteCommitted})
|
tx, err := r.db.BeginTx(ctx, &sql.TxOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -323,6 +323,11 @@ func (r *DownloadClientRepo) deleteClientFromAction(ctx context.Context, tx *Tx,
|
||||||
var filterID int
|
var filterID int
|
||||||
|
|
||||||
if err = queryBuilder.QueryRowContext(ctx).Scan(&filterID); err != nil {
|
if err = queryBuilder.QueryRowContext(ctx).Scan(&filterID); err != nil {
|
||||||
|
// this will throw when the client is not connected to any actions
|
||||||
|
// it is not an error in this case
|
||||||
|
if errors.Is(err, sql.ErrNoRows) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return errors.Wrap(err, "error executing query")
|
return errors.Wrap(err, "error executing query")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue