Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split feed and user activities #32110

Open
lunny opened this issue Sep 23, 2024 · 0 comments
Open

Split feed and user activities #32110

lunny opened this issue Sep 23, 2024 · 0 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@lunny
Copy link
Member

lunny commented Sep 23, 2024

Problem

Currently, the heatmap, dashboard feed, and personal activities are shared with the same table action. This resulted in some pages becoming slow even if we optimized the database index many times.

Lifecycles

However the content of the 3 places is similar, But the requirements from the 3 places have different lifecycles.

  • For the dashboard feed, keeping the last several days may be enough. Looks at Github, only about 3 days.
  • For heatmap and personal activities, all the events should be kept and never deleted.

Resolution

So that we can create another 1 or 2 new tables to resolve the problem, the new table will store the user's activities only.
The possible table definition will be like below.

type UserActivity struct {
    ID int64
    UserID int64 `xorm:"index"`
    Action string // created, deleted, opened merged, reviewed, joined, pushed
    RepoID int64
    IssueID int64
    CommitIDs []string
    EventDate timestamp `xorm:"index"`
}

What's the difference between action table and the new table? action table have many duplicated, once you watch a repository, every event related to this repository will be copied to every watchers. But for the new table, an event will be record only once.

So that, for the current action table, maybe it can be changed like this. It will contain only maybe recent 7 days feeds.

type UserFeed struct {
    ID int64
    WatcherID int64 `xorm:"index"`
    ActivityID int64
    Created timestamp
}
@lunny lunny added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

1 participant