Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/controllers/concerns/idv_step_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ def step_attempts_exceeded?
end

def confirm_step_allowed
redirect_to_fail_url if step_attempts_exceeded?
if step_attempts_exceeded?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure it's in the AC but how about logic to only log it once when the limit is reached? (vs on every retry)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On second thought we can just query distinct. Probably better to log it.

Copy link
Copy Markdown
Contributor

@stevegsa stevegsa Mar 31, 2021

Choose a reason for hiding this comment

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

Flip flopping again. Def better to know if they hit the limit separately (and only once for the window). Hitting the limit, waiting the window and getting throttled again should be separate from 2 tries when throttled in one window.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We don't have a good way to only log once unfortunately. We initially had the event fire when the throttler incremented to be on the final attempt, but since it's possible for the final attempt to succeed that wasn't a great way to capture that someone was throttled. We typically only have throttler checks at the beginning of an action, which means it can happen multiple times :/

For reference, this builds on work from #4829

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We could have two separate events or one event and a boolean which indicates they are retrying and still throttled

Copy link
Copy Markdown
Contributor

@stevegsa stevegsa Mar 31, 2021

Choose a reason for hiding this comment

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

"We don't have a good way to only log once unfortunately." - We'd have to keep incrementing the throttle and do a check but that's a big change. I'll go ahead and approve

analytics.track_event(
Analytics::THROTTLER_RATE_LIMIT_TRIGGERED,
throttle_type: :idv_resolution,
step_name: step_name,
)
redirect_to_fail_url
end
end

def redirect_to_fail_url
Expand Down
1 change: 1 addition & 0 deletions app/controllers/idv/gpo_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def max_attempts_reached
analytics.track_event(
Analytics::THROTTLER_RATE_LIMIT_TRIGGERED,
throttle_type: :idv_resolution,
step_name: :gpo,
)
flash_error
end
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/idv_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def index
elsif active_profile? && !liveness_upgrade_required?
redirect_to idv_activated_url
elsif idv_attempter_throttled?
analytics.track_event(
Analytics::THROTTLER_RATE_LIMIT_TRIGGERED,
throttle_type: :idv_resolution,
)
Comment on lines +15 to +18
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it intentional to omit the step_name from this one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This check happens before a step or anything is reached, so step_name doesn't exist

redirect_to idv_fail_url
elsif sp_over_quota_limit?
flash[:error] = t('errors.doc_auth.quota_reached')
Expand Down
1 change: 1 addition & 0 deletions app/services/idv/steps/doc_auth_base_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def idv_failure(result)
@flow.analytics.track_event(
Analytics::THROTTLER_RATE_LIMIT_TRIGGERED,
throttle_type: :idv_resolution,
step_name: self.class,
)
redirect_to idv_session_errors_failure_url
elsif result.extra.dig(:proofing_results, :exception).present?
Expand Down
2 changes: 2 additions & 0 deletions spec/features/idv/doc_auth/verify_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
expect(fake_analytics).to have_logged_event(
Analytics::THROTTLER_RATE_LIMIT_TRIGGERED,
throttle_type: :idv_resolution,
step_name: Idv::Steps::VerifyWaitStepShow,
)

Timecop.travel(AppConfig.env.idv_attempt_window_in_hours.to_i.hours.from_now) do
Expand Down Expand Up @@ -136,6 +137,7 @@
expect(fake_analytics).to have_logged_event(
Analytics::THROTTLER_RATE_LIMIT_TRIGGERED,
throttle_type: :idv_resolution,
step_name: Idv::Steps::VerifyWaitStepShow,
)
end

Expand Down