Skip to content

Only create sp_return_logs on SP handoff#6141

Merged
mitchellhenke merged 2 commits intomainfrom
mitchellhenke/sp-return-logs!
Apr 1, 2022
Merged

Only create sp_return_logs on SP handoff#6141
mitchellhenke merged 2 commits intomainfrom
mitchellhenke/sp-return-logs!

Conversation

@mitchellhenke
Copy link
Contributor

Currently, we create an SpReturnLog when someone arrives from a service provider, and then update the record if and when the person is redirected back to the service provider. This functionality is quite write-heavy since a record is created on every SP authentication and later updated upon SP return. This functionality is primarily for billing, so some care is warranted around changing the behavior.

For billing, users that are not redirected back do not get counted as billable, and after speaking with @stevegsa, my understanding is that the success_rate_by_sp report is not used heavily.

With that in mind, this PR changes the SpReturnLog functionality to only create the SpReturnLog row on the SP return, so that there is only one insert, instead of an insert and an update to help reduce the load on the database.

@mitchellhenke mitchellhenke requested a review from stevegsa April 1, 2022 20:29
changelog: Internal, Optimization, Only create service provider return logs for billable events
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/sp-return-logs! branch from 322d7bc to e916b45 Compare April 1, 2022 20:32
@stevegsa
Copy link
Contributor

stevegsa commented Apr 1, 2022

Excellent!

Copy link
Contributor

@stevegsa stevegsa left a comment

Choose a reason for hiding this comment

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

Excellent job!

@mitchellhenke mitchellhenke force-pushed the mitchellhenke/sp-return-logs! branch from 04497d9 to 4d856e7 Compare April 1, 2022 21:01
@mitchellhenke mitchellhenke marked this pull request as ready for review April 1, 2022 21:05
@mitchellhenke mitchellhenke merged commit 460f283 into main Apr 1, 2022
@mitchellhenke mitchellhenke deleted the mitchellhenke/sp-return-logs! branch April 1, 2022 21:20
@@ -70,11 +70,6 @@
args: -> { [Time.zone.today] },
},
# Send Sp Success Rate Report to S3
Copy link
Contributor

Choose a reason for hiding this comment

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

should we have dropped this comment line too?

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.

3 participants