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

Reduced number of requests from client to server #7446

Merged
merged 19 commits into from
Feb 8, 2024

Conversation

bsekachev
Copy link
Member

@bsekachev bsekachev commented Feb 6, 2024

Motivation and context

  1. Memoize initial users to not request list for each UserSelector, there are plenty of these selectors, especially on task page with a list of jobs

  2. Do not make extra save annotation request with empty body

  3. When moving a task to a project, patch labels requests are send one by one, not in parallel

image
  1. Do not duplicate exceptions events in dev environment (see. The fake event trick for rethrowing errors in DEV fires unexpected global error handlers and makes testing harder facebook/react#10474)

  2. Do not create excessive requests when lots of exceptions happen.

image

But when UI failed, logs are sent immediately

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Copy link

codecov bot commented Feb 8, 2024

Codecov Report

Merging #7446 (f021905) into develop (dc40be2) will increase coverage by 0.10%.
Report is 1 commits behind head on develop.
The diff coverage is 91.83%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7446      +/-   ##
===========================================
+ Coverage    83.44%   83.54%   +0.10%     
===========================================
  Files          374      374              
  Lines        39753    39753              
  Branches      3729     3731       +2     
===========================================
+ Hits         33170    33213      +43     
+ Misses        6583     6540      -43     
Components Coverage Δ
cvat-ui 79.50% <91.83%> (+0.23%) ⬆️
cvat-server 87.26% <ø> (-0.01%) ⬇️

Copy link
Contributor

@klakhov klakhov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks PR lacks changelog and package.json updates

cvat-core/src/logger-storage.ts Outdated Show resolved Hide resolved
@@ -309,11 +309,11 @@ const tasksDummyLabelsData = {
attributes: [],
}],
100: [{
id: 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need such change?

Copy link
Member Author

@bsekachev bsekachev Feb 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have other labels with id: 1 in mock data, and as I discovered, in one of tests we remove label and it removes all labels with the same id from everywhere

//
// SPDX-License-Identifier: MIT

import { ActionUnion, createAction, ThunkAction } from 'utils/redux';
import { RegisterData } from 'components/register-page/register-form';
import { getCore } from 'cvat-core-wrapper';
import { getCore, User } from 'cvat-core-wrapper';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was already refactored in #7431 here. I dont think we need the changes here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#7431 is not merged
When we merge this one, these changes will disappear from another PR.

So, what is the problem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it here because now in UserSelector component I need current user id. And, there were not types before

cvat-ui/src/components/task-page/user-selector.tsx Outdated Show resolved Hide resolved
}

const key = `${userID}_${organizationSLUG || ''}`;
const RELOAD_INITIAL_USERS_AFTER_MS = 300000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt this number too large?

Copy link
Member Author

@bsekachev bsekachev Feb 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see any problems with 5 minutes. If user can't see somebody's name, typical behavior is to start entering this name. This memoization will by bypassed.

cvat-ui/src/index.tsx Outdated Show resolved Hide resolved
@bsekachev bsekachev merged commit 9f517d1 into develop Feb 8, 2024
34 checks passed
@bsekachev bsekachev deleted the bs/reduced_number_of_requests branch February 8, 2024 17:32
@cvat-bot cvat-bot bot mentioned this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants