mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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:
@@ -41,7 +41,7 @@ func (p *Processor) Create(ctx context.Context, account *gtsmodel.Account, form
|
||||
}
|
||||
|
||||
// validate + fetch target account
|
||||
targetAccount, err := p.db.GetAccountByID(ctx, form.AccountID)
|
||||
targetAccount, err := p.state.DB.GetAccountByID(ctx, form.AccountID)
|
||||
if err != nil {
|
||||
if errors.Is(err, db.ErrNoEntries) {
|
||||
err = fmt.Errorf("account with ID %s does not exist", form.AccountID)
|
||||
@@ -52,7 +52,7 @@ func (p *Processor) Create(ctx context.Context, account *gtsmodel.Account, form
|
||||
}
|
||||
|
||||
// fetch statuses by IDs given in the report form (noop if no statuses given)
|
||||
statuses, err := p.db.GetStatuses(ctx, form.StatusIDs)
|
||||
statuses, err := p.state.DB.GetStatuses(ctx, form.StatusIDs)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("db error fetching report target statuses: %w", err)
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
@@ -79,11 +79,11 @@ func (p *Processor) Create(ctx context.Context, account *gtsmodel.Account, form
|
||||
Forwarded: &form.Forward,
|
||||
}
|
||||
|
||||
if err := p.db.PutReport(ctx, report); err != nil {
|
||||
if err := p.state.DB.PutReport(ctx, report); err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
p.clientWorker.Queue(messages.FromClientAPI{
|
||||
p.state.Workers.EnqueueClientAPI(ctx, messages.FromClientAPI{
|
||||
APObjectType: ap.ObjectProfile,
|
||||
APActivityType: ap.ActivityFlag,
|
||||
GTSModel: report,
|
||||
|
Reference in New Issue
Block a user