mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-11 06:24:04 +00:00
Don't use transactions when direct db access is enough
For read-only action transactions are not necessary and they risk to deadlock if multiple go-routines try to read the database.
This commit is contained in:
+1
-7
@@ -898,13 +898,7 @@ func (collection *RemoteRepoCollection) Len() int {
|
||||
|
||||
// Drop removes remote repo from collection
|
||||
func (collection *RemoteRepoCollection) Drop(repo *RemoteRepo) error {
|
||||
transaction, err := collection.db.OpenTransaction()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer transaction.Discard()
|
||||
|
||||
if _, err = transaction.Get(repo.Key()); err != nil {
|
||||
if _, err := collection.db.Get(repo.Key()); err != nil {
|
||||
if err == database.ErrNotFound {
|
||||
return errors.New("repo not found")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user