Add missing Unlock calls.
このコミットが含まれているのは:
コミット
b41491e2c2
|
@ -128,19 +128,26 @@ func (a *sideEffectActor) InboxForwarding(c context.Context, inboxIRI *url.URL,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer a.db.Unlock(c, id.Get())
|
// WARNING: Unlock is not deferred
|
||||||
|
//
|
||||||
// If the database already contains the activity, exit early.
|
// If the database already contains the activity, exit early.
|
||||||
exists, err := a.db.Exists(c, id.Get())
|
exists, err := a.db.Exists(c, id.Get())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
a.db.Unlock(c, id.Get())
|
||||||
return err
|
return err
|
||||||
} else if exists {
|
} else if exists {
|
||||||
|
a.db.Unlock(c, id.Get())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// Attempt to create the activity entry.
|
// Attempt to create the activity entry.
|
||||||
err = a.db.Create(c, activity)
|
err = a.db.Create(c, activity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
a.db.Unlock(c, id.Get())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
a.db.Unlock(c, id.Get())
|
||||||
|
// Unlock by this point and in every branch above.
|
||||||
|
//
|
||||||
// 2. The values of 'to', 'cc', or 'audience' are Collections owned by
|
// 2. The values of 'to', 'cc', or 'audience' are Collections owned by
|
||||||
// this server.
|
// this server.
|
||||||
var r []*url.URL
|
var r []*url.URL
|
||||||
|
@ -413,7 +420,7 @@ func (a *sideEffectActor) addToOutbox(c context.Context, outboxIRI *url.URL, act
|
||||||
a.db.Unlock(c, id.Get())
|
a.db.Unlock(c, id.Get())
|
||||||
// WARNING: Unlock(c, id) should be called by this point and in every
|
// WARNING: Unlock(c, id) should be called by this point and in every
|
||||||
// return before here.
|
// return before here.
|
||||||
|
//
|
||||||
// Acquire a lock to read the outbox. Defer release.
|
// Acquire a lock to read the outbox. Defer release.
|
||||||
err = a.db.Lock(c, outboxIRI)
|
err = a.db.Lock(c, outboxIRI)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
読み込み中…
新しいイシューから参照