leantime icon indicating copy to clipboard operation
leantime copied to clipboard

[BUG] jQuery initiates LOTS of PATCH requests to index.php while resizing

Open phulstaert opened this issue 2 years ago • 7 comments

When a user resizes a window, jQuery sends out a lot of PATCH HTTP requests. (between 8 and 12 per second per user) Because of this, I receive lots of "server reached pm.max_children"-warnings.

To Reproduce Steps to reproduce the behavior:

  1. Open Leantime
  2. Either look at the HTTP servers logs or at the development tools network tab in google chrome.
  3. Resize the window
  4. see a lot of requests

image

Expected behavior I don't know what they do, but we have to throttle this to once a second max.

Leantime Version 2.2.4 - Docker-compose version

Additional context When a hand full of people are using the system, this could be ignored, but in bigger settings, this would slow everything down.

phulstaert avatar Aug 07 '22 19:08 phulstaert

Woah, that is weird. Is that on the kanban screen? Do you know what is being patched?

My first guess is that sortable() is being triggered on a resize() which in turn sends a patch to update ticket status. I’ll check it out.

On Sun, Aug 7, 2022 at 3:05 PM Peter Hulstaert @.***> wrote:

When a user resizes a window, jQuery sends out a lot of PATCH HTTP requests. (between 8 and 12 per second per user) Because of this, I receive lots of "server reached pm.max_children"-warnings.

To Reproduce Steps to reproduce the behavior:

  1. Open Leantime
  2. Either look at the HTTP servers logs or at the development tools network tab in google chrome.
  3. Resize the window
  4. see a lot of requests

[image: image] https://user-images.githubusercontent.com/8971696/183306936-6e5fa96c-42a8-4282-a997-a9ec7ea14883.png

Expected behavior I don't know what they do, but we have to throttle this to once a second max.

Leantime Version 2.2.4 - Docker-compose version

Additional context When a hand full of people are using the system, this could be ignored, but in bigger settings, this would slow everything down.

— Reply to this email directly, view it on GitHub https://github.com/Leantime/leantime/issues/852, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALG4EFQE7XURJGQCXW466V3VYACG7ANCNFSM5525FRZA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

marcelfolaron avatar Aug 07 '22 20:08 marcelfolaron

Every page, all the time (with and without a modal screen active)

phulstaert avatar Aug 07 '22 20:08 phulstaert

Well... not all the time... only when resizing :-D

phulstaert avatar Aug 07 '22 20:08 phulstaert

image

phulstaert avatar Aug 07 '22 20:08 phulstaert

Found it. It's in the menu controller javascript that stores whether the left menu is open or not. https://github.com/Leantime/leantime/blob/0d8ec77ae78654191553f0b62ce204e1859487d8/src/domain/general/js/menuController.js#L71

I can't believe no one found that before. This has been working this way for a very long time. (3 years based on git blame)

Good catch!

On Sun, Aug 7, 2022 at 4:22 PM Peter Hulstaert @.***> wrote:

Well... not all the time... only when resizing :-D

— Reply to this email directly, view it on GitHub https://github.com/Leantime/leantime/issues/852#issuecomment-1207478901, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALG4EFW7VXWQH4D3WDDLVGLVYALGRANCNFSM5525FRZA . You are receiving this because you commented.Message ID: @.***>

marcelfolaron avatar Aug 07 '22 20:08 marcelfolaron

Glad I can be of help. You really found that fast :-)

phulstaert avatar Aug 07 '22 20:08 phulstaert

Maybe this type of solution might help?

https://stackoverflow.com/questions/5489946/how-to-wait-for-the-end-of-resize-event-and-only-then-perform-an-action

The easiest of them all is this one. This comes down to "if you stop resizing for x ms; do something". So this is kind of an 'end resize' event.

phulstaert avatar Aug 08 '22 05:08 phulstaert

huh, yeah I see it now. It sends requests to api/session . Now let me find the culprit.

On Sun, Aug 7, 2022 at 4:22 PM Peter Hulstaert @.***> wrote:

Well... not all the time... only when resizing :-D

— Reply to this email directly, view it on GitHub https://github.com/Leantime/leantime/issues/852#issuecomment-1207478901, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALG4EFW7VXWQH4D3WDDLVGLVYALGRANCNFSM5525FRZA . You are receiving this because you commented.Message ID: @.***>

marcelfolaron avatar Oct 11 '22 08:10 marcelfolaron

Well I just searched for ".resize(" :D

On Sun, Aug 7, 2022 at 4:32 PM Peter Hulstaert @.***> wrote:

Glad I can be of help. You really found that fast :-)

— Reply to this email directly, view it on GitHub https://github.com/Leantime/leantime/issues/852#issuecomment-1207480469, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALG4EFVGEDSI35XV2DBLGL3VYAMN3ANCNFSM5525FRZA . You are receiving this because you commented.Message ID: @.***>

marcelfolaron avatar Oct 11 '22 09:10 marcelfolaron