Skip to content

Comment history is loading slowly + has an offByOne error #17676

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

Closed
delvh opened this issue Nov 17, 2021 · 8 comments
Closed

Comment history is loading slowly + has an offByOne error #17676

delvh opened this issue Nov 17, 2021 · 8 comments
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail performance/speed performance issues with slow downs topic/ui-interaction Change the process how users use Gitea instead of the visual appearance type/bug

Comments

@delvh
Copy link
Member

delvh commented Nov 17, 2021

Gitea Version

1.16.0+dev-519-g3be156f66

Operating System

Linux

Browser Version

Firefox 94.0

Can you reproduce the bug on the Gitea demo site?

Yes

Description

Gitea now supports the comment history.
However, loading the history seems to be way too slow:

For normal comments, the history will automatically be loaded once the page is reloaded.
Fine so far. Still with a hefty delay (~3 seconds, so you definitely notice when the history suddenly appears), but it loads.

The issue bodies (the description of the issue) are way worse:
According to my tests on try.gitea.io, there seems to be an index error for those, as they only load once a second edit has been made. Once the second edit has been made, it behaves like a normal comment.

So, two things should be done:

  1. the offByOne error should be fixed.
  2. the history should be loaded faster, at best to the point that it is unnoticeable that it has been loaded afterwards.

Screenshots

image
This is an issue description where one edit has been made and the page has been force-reloaded. As you see, the history is not getting displayed.

@delvh delvh added type/bug issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented performance/speed performance issues with slow downs topic/ui-interaction Change the process how users use Gitea instead of the visual appearance labels Nov 17, 2021
@jpraet
Copy link
Member

jpraet commented Nov 20, 2021

I think the offByOne happens when editing old issues/comments (created before there was support for edit history).

@wxiaoguang
Copy link
Contributor

I think the offByOne happens when editing old issues/comments (created before there was support for edit history).

👍 Yep, the history menu won't be shown if there is only one history revision (that's by design).

For old comments, there was no history revision before, so the first editing would save the first history revision, and the menu would only be shown for the second editing.

@wxiaoguang
Copy link
Contributor

And I haven't noticed any performance problem on my Gitea instance. The menu is always shown within 1 second.

If you believe there is a performance problem, please make sure your network is fast enough and help to find which function/sql causes the laggy.

@wxiaoguang wxiaoguang added issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail and removed issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels Nov 20, 2021
@jpraet
Copy link
Member

jpraet commented Nov 20, 2021

To support edit history for existing comments: maybe the issue_content_history can be initialized with the initial (is_first_created) content when editing a comment that does not have such an entry yet?

@wxiaoguang
Copy link
Contributor

To support edit history for existing comments: maybe the issue_content_history can be initialized with the initial (is_first_created) content when editing a comment that does not have such an entry yet?

Agree, it would work.

@jpraet
Copy link
Member

jpraet commented Nov 21, 2021

Or the issue_content_history could only be populated with the previous value when actually making an edit?
Because with the current implementation all issue contents and comments are unnecessarily saved twice in the database.

@wxiaoguang
Copy link
Contributor

Or the issue_content_history could only be populated with the previous value when actually making an edit? Because with the current implementation all issue contents and comments are unnecessarily saved twice in the database.

I have thought about it, but it would make the algorithm more complex (eg: list/diff), usually I prefer a simple and clear solution. And issue contents are much smaller than git repositories, saving the contents won't cost too much in modern days.

@wxiaoguang
Copy link
Contributor

I think this issue can be closed by #17746

The "performance" problem may not be related. If there is really a performance problem, we need more details (and a separate issue)

@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail performance/speed performance issues with slow downs topic/ui-interaction Change the process how users use Gitea instead of the visual appearance type/bug
Projects
None yet
Development

No branches or pull requests

3 participants