Skip to content

Conversation

@SegiNyn
Copy link
Contributor

@SegiNyn SegiNyn commented Nov 8, 2023

No description provided.

@SegiNyn SegiNyn force-pushed the session-expiry-dialog branch 3 times, most recently from 20f3745 to 053f2c3 Compare November 13, 2023 10:40
@SegiNyn SegiNyn force-pushed the session-expiry-dialog branch 2 times, most recently from bafaab0 to 303374a Compare November 16, 2023 15:14
@SegiNyn SegiNyn marked this pull request as draft November 16, 2023 15:49
@SegiNyn SegiNyn force-pushed the session-expiry-dialog branch 2 times, most recently from ca147fa to f5cb98c Compare November 27, 2023 11:21
@SegiNyn SegiNyn marked this pull request as ready for review November 27, 2023 11:28
@ThiefMaster ThiefMaster force-pushed the session-expiry-dialog branch 4 times, most recently from 271b4fc to 430a206 Compare December 4, 2023 21:24
@ThiefMaster
Copy link
Member

ThiefMaster commented Dec 4, 2023

Some more issues I noticed while testing:

  • When you have two tabs open, the session expires, and you log in again in one of the tabs, the other tabs almost immediately sends an outdated null expiry message and thus shows the dialog telling you the session has expired, even though it's still valid. I think once the session is expired, no more messages should be sent
  • When the dialog opens, it shows 120 regardless of the actual remaining time for a second
  • In some cases I end up with the session-expiry endpoint getting hit with tons of requests per second. This happens because moment.utc(sessionExpiry).subtract('120', 'seconds') - moment.utc() will return NaN when sessionExpiry is null.

But that aside, I think the syncing works really well!

@ThiefMaster ThiefMaster force-pushed the session-expiry-dialog branch 2 times, most recently from 551be90 to a2cc047 Compare December 4, 2023 23:08
@ThiefMaster
Copy link
Member

I think the whole logic of the react component can be vastly simplified. I might push something tomorrow...

@SegiNyn
Copy link
Contributor Author

SegiNyn commented Dec 5, 2023

Thanks for the review @ThiefMaster, sure I welcome simplifying the component, please let me know if it's something i can also do on my end. Thanks.

@ThiefMaster ThiefMaster force-pushed the session-expiry-dialog branch 2 times, most recently from 7005d40 to 39ca439 Compare December 6, 2023 13:06
@SegiNyn SegiNyn force-pushed the session-expiry-dialog branch from 39ca439 to 770d8b0 Compare January 3, 2024 09:18
@ThiefMaster ThiefMaster force-pushed the session-expiry-dialog branch from 770d8b0 to 76a3478 Compare January 11, 2024 15:46
@ThiefMaster
Copy link
Member

Now that I'm back from the xmas break I finally found some time to finish the simplified version. Have a look at session_expiry_new.js from my last commit. To test the re-login part, I suggest setting SESSION_LIFETIME = 30 in indico.conf, and for refreshing SESSION_LIFETIME = 1300 works well.

When testing it with two browser tabs it synced nicely, but avoids the huge complexity of having a separate component that's just running the interval, and also the useRefs (refs often make code harder to read/maintain).

@ThiefMaster ThiefMaster force-pushed the session-expiry-dialog branch from 69782d6 to 715c5b2 Compare January 11, 2024 18:54
@SegiNyn
Copy link
Contributor Author

SegiNyn commented Jan 12, 2024

Wow it was a total rewrite!!! The component works nicely. I just have a couple of comments about the syncing which I don't know if some were done on purpose or not.

  1. The dialog first appears at 1 sec less than the value of SHOW_DIALOG_THRESHOLD
  2. The timing of the snooze may not be straightforward to understand for a user. It’s nice when there is still 2 minutes left and you hit on snooze then it shows again after 1 minute. But hitting on snooze when it’s 20 seconds left or 10 seconds left, it would be too often for it to be showing up again and again in half the time.
  3. After snoozing on one window and the session is refreshed on another window, the next time the dialog appears on the snoozed window depends on the previous snooze time. For example if my session lasts for 3600s and I hit snooze at just 20 Seconds before expiry and then refresh the session in another window for another 3600s, then the next time the countdown appears on the snoozed browser would be at 20/2=10 instead of at SHOW_DIALOG_THRESHOLD
  4. The interval does not stop even after the session has expired. So "ignoring new expiry on expired session" is actually only ignored on the next interval but it syncs up the expired tabs again in the intervals after that

@ThiefMaster
Copy link
Member

  1. I didn't really test for off-by-one since one second doesn't really matter. Anyway should be an easy fix ;)
  2. Yes, this could easily be adjusted.
  3. Might have missed resetting it (I know I added a reset when you refresh 'locally')
  4. Not sure I understand. The interval keeps running but it should ignore any updates from other tabs etc. Or do you mean that the expired one keeps sending out data to other tabs?

@SegiNyn
Copy link
Contributor Author

SegiNyn commented Jan 15, 2024

The interval keeps running but it should ignore any updates from other tabs etc.

  1. Yes exactly this - the interval keeps running but it does not ignore updates from other tabs after a while

@ThiefMaster ThiefMaster force-pushed the session-expiry-dialog branch from 715c5b2 to 114ef15 Compare March 18, 2024 16:22
SegiNyn and others added 9 commits March 19, 2024 10:36
For long session lifetimes this doesn't matter, but when testing with
very low lifetimes it's annoying that the refresh endpoint only does
something when half the old session lifetime has been used.
By default the login page doesn't do anything while logged-in, but when
dealing with a session that has a hard expiry, one may want to refresh
their login (by logging in again) even before the session expired.
@ThiefMaster ThiefMaster force-pushed the session-expiry-dialog branch from ca817e2 to 5e2d644 Compare March 19, 2024 09:36
@ThiefMaster
Copy link
Member

1,3,4 are fixed. Any suggestion for a better snooze behavior in point 2? (also see my more verbose msg on matrix)

@ThiefMaster ThiefMaster force-pushed the session-expiry-dialog branch from 3fb72e1 to 6cfbb56 Compare March 20, 2024 09:09
@ThiefMaster ThiefMaster added this to the v3.3 milestone Mar 20, 2024
@ThiefMaster ThiefMaster enabled auto-merge (squash) March 20, 2024 16:21
@ThiefMaster ThiefMaster merged commit 068806b into indico:master Mar 20, 2024
@ThiefMaster ThiefMaster deleted the session-expiry-dialog branch March 20, 2024 16:25
vtran99 pushed a commit to UNOG-Indico/indico-core that referenced this pull request Mar 25, 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