mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 15:42:24 -05:00
first implementation of search feature
This commit is contained in:
parent
cb54324430
commit
0fe853b1ee
20 changed files with 763 additions and 19 deletions
|
|
@ -42,6 +42,10 @@ func (f *federatingDB) Lock(c context.Context, id *url.URL) error {
|
|||
|
||||
// Strategy: create a new lock, if stored, continue. Otherwise, lock the
|
||||
// existing mutex.
|
||||
if id == nil {
|
||||
return errors.New("Lock: id was nil")
|
||||
}
|
||||
|
||||
mu := &sync.Mutex{}
|
||||
mu.Lock() // Optimistically lock if we do store it.
|
||||
i, loaded := f.locks.LoadOrStore(id.String(), mu)
|
||||
|
|
@ -59,6 +63,9 @@ func (f *federatingDB) Lock(c context.Context, id *url.URL) error {
|
|||
func (f *federatingDB) Unlock(c context.Context, id *url.URL) error {
|
||||
// Once Go-Fed is done calling Database methods, the relevant `id`
|
||||
// entries are unlocked.
|
||||
if id == nil {
|
||||
return errors.New("Unlock: id was nil")
|
||||
}
|
||||
|
||||
i, ok := f.locks.Load(id.String())
|
||||
if !ok {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue