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

optimize loading of time entries #646

Open
HenrikeW opened this issue Sep 12, 2022 · 2 comments
Open

optimize loading of time entries #646

HenrikeW opened this issue Sep 12, 2022 · 2 comments
Labels
backend This is likely affecting the backend frontend This is likely affecting the frontend refactor

Comments

@HenrikeW
Copy link
Contributor

HenrikeW commented Sep 12, 2022

Description

  • Check how exactly time entries for a week are loaded right now
  • see if there is a better way of doing it, e.g. fetching all time entries for the whole week in one query and then filter what we need.

Info

If this seems difficult or takes a long time, do #906 first.

@HenrikeW HenrikeW added frontend This is likely affecting the frontend refactor labels Sep 12, 2022
@kusalananda
Copy link
Member

kusalananda commented Oct 18, 2024

Currently, the frontend code appears to make one Redmine query per row. These are essentially variations of the following query, with different combinations of issue_id and activity_id values:

/time_entries.json?user_id=me&issue_id=6818&activity_id=13&from=2024-10-14&to=2024-10-18&offset=0&limit=100&user_id=me

These could quite likely be combined into a single query, by removing the issue_id and activity_id,

/time_entries.json?user_id=me&from=2024-10-14&to=2024-10-18&offset=0&limit=100&user_id=me

... that the code later parses the needed information out of. Care must be taken to ensure that all information is fetched, either by increasing the limit parameter to some larger number, but ideally by implementing proper paging (multiple queries with an increasing offset value to get further data), or a combination thereof.

Paging like this is already implemented for computing the "Yearly overview". To show this bar all time entries for the whole year are fetched (which is a possible reason users start complaining about slowness towards the end of the year (!)).

This is an example of a query made to construct the "Yearly overview" bar:

/time_entries.json?user_id=me&from=2024-01-01&to=2024-12-31&offset=500&limit=100&user_id=me

@kusalananda
Copy link
Member

kusalananda commented Oct 18, 2024

There are also some clear cases for optimising the backend Go code, especially the code in getPriorityEntriesHandler.go. I'm adding the "backend" label to this issue. This likely means that this issue will have two PRs.

@kusalananda kusalananda added the backend This is likely affecting the backend label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend This is likely affecting the backend frontend This is likely affecting the frontend refactor
Projects
None yet
Development

No branches or pull requests

2 participants