[chore] move client/federator workerpools to Workers{} (#1575)

* replace concurrency worker pools with base models in State.Workers, update code and tests accordingly

* improve code comment

* change back testrig default log level

* un-comment-out TestAnnounceTwice() and fix

---------

Signed-off-by: kim <grufwub@gmail.com>
Reviewed-by: tobi
This commit is contained in:
kim 2023-03-01 18:26:53 +00:00 committed by GitHub
commit baf933cb9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
130 changed files with 1037 additions and 1083 deletions

View file

@ -85,12 +85,12 @@ func (f *federatingDB) InboxesForIRI(c context.Context, iri *url.URL) (inboxIRIs
return nil, fmt.Errorf("couldn't extract local account username from uri %s: %s", iri, err)
}
account, err := f.db.GetAccountByUsernameDomain(c, localAccountUsername, "")
account, err := f.state.DB.GetAccountByUsernameDomain(c, localAccountUsername, "")
if err != nil {
return nil, fmt.Errorf("couldn't find local account with username %s: %s", localAccountUsername, err)
}
follows, err := f.db.GetAccountFollowedBy(c, account.ID, false)
follows, err := f.state.DB.GetAccountFollowedBy(c, account.ID, false)
if err != nil {
return nil, fmt.Errorf("couldn't get followers of local account %s: %s", localAccountUsername, err)
}
@ -98,7 +98,7 @@ func (f *federatingDB) InboxesForIRI(c context.Context, iri *url.URL) (inboxIRIs
for _, follow := range follows {
// make sure we retrieved the following account from the db
if follow.Account == nil {
followingAccount, err := f.db.GetAccountByID(c, follow.AccountID)
followingAccount, err := f.state.DB.GetAccountByID(c, follow.AccountID)
if err != nil {
if err == db.ErrNoEntries {
continue
@ -126,7 +126,7 @@ func (f *federatingDB) InboxesForIRI(c context.Context, iri *url.URL) (inboxIRIs
}
// check if this is just an account IRI...
if account, err := f.db.GetAccountByURI(c, iri.String()); err == nil {
if account, err := f.state.DB.GetAccountByURI(c, iri.String()); err == nil {
// deliver to a shared inbox if we have that option
var inbox string
if config.GetInstanceDeliverToSharedInboxes() && account.SharedInboxURI != nil && *account.SharedInboxURI != "" {