assemblee-virtuelle / assemblee-virtuelle/semapps

Refactor ActivitiesHandlerMixin

Open
#1,230 2 comments 0 reactions 0 assignees View on GitHub
refactoring
Dominant language
TypeScript
Stars
103
Forks
14
Avg merge
1m
Merged PRs (30d)
2

Description

## Problem

Right now, for every service using the `ActivitiesHandlerMixin`, a matching is made for all activities received or sent. The more services are doing this, the worst the performance become.

## Solution

Create a `ActivitiesWatcherService` which is activated by default with the ActivityPub service.

This service as a `watch` action which takes a `matcher` (object or function), an `actionName` and a `key`.

On start, the ActivitiesHandlerMixin calls the `watch` function for all defined activities. The `actionName` is a `processActivity` action of this mixin.

The `process` action receives a `key`, a `boxType` (inbox/outbox), a `dereferencedActivity` and `actorUri`.

It thens calls the onEmit and onReceive methods of the corresponding activity.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating ActivitiesHandlerMixin and the ActivityPub service, then trace its processActivity flow and the activities currently matched by each service. Review how the proposed ActivitiesWatcherService would expose watch and process, and verify that onEmit and onReceive still run for the corresponding activity. Done means matching is centralized without changing activity handling behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.