ubuntu / authd

Authentication daemon for external Brokers
GNU Lesser General Public License v3.0
110 stars 9 forks source link

qrcodemodel: Rate limit the emission of reselect auth mode events #513

Closed 3v1n0 closed 1 month ago

3v1n0 commented 1 month ago

When hitting the Enter key for a while, bubbletea sends lots of events and we may imply sending reselectAuthMode{} events faster than we can actually handle the cancellation/reauthModeSelection in the whole stack.

This never happened (ever) when using the example broker, but it may actually happen in a real world scenario where the broker may not cancel the requests quickly enough.

Do this instead of avoiding the handling of the reselectAuthMode event because it's better to prevent bubbletea to break our (fragile) system.

The change is already tested by authenticate_user_with_qr_code_after_many_regenerations test.

UDENG-4091

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.65%. Comparing base (223a072) to head (f3fb9ec).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #513 +/- ## ========================================== - Coverage 84.75% 84.65% -0.11% ========================================== Files 79 79 Lines 6942 6948 +6 Branches 75 75 ========================================== - Hits 5884 5882 -2 - Misses 739 743 +4 - Partials 319 323 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.