omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Added index to Django Association model #969

Closed clintonb closed 8 years ago

clintonb commented 8 years ago

This unique_together index on the server_url and handle columns ensures lookups do not result in full table scans.

Fixes #967

clintonb commented 8 years ago

@omab please review FYI @jibsheet

rlucioni commented 8 years ago

I think it's worth noting that running the migration in this PR against a MySQL database will incur downtime while the index is added (reference).

clintonb commented 8 years ago

Acknowledged @rlucioni. I have also filed #970 to address the fact that this table should not store nonces forever. They should be removed once the authorization response is validated. Long-term it might make more sense to use Django's caching layer for this purpose rather than the database model.

rlucioni commented 8 years ago

@clintonb 👍

rlucioni commented 8 years ago

@omab thoughts on this?

omab commented 8 years ago

As per the downtime, handling that is out of the scope of a simple lib, in fact the possible solutions mention in the stackoverflow question are mostly architectural. Still, thanks for the notice.

About the nounces, I agree that they shouldn't reside in the DB and I've been planning on removing that table for a while, probably just use the framework of choise session mechanism.

omab commented 8 years ago

Thanks!

rlucioni commented 8 years ago

@omab would it be possible to publish v0.2.20 so that the community can take advantage of this change?

omab commented 8 years ago

@rlucioni, v0.2.20 released to pypi.

rlucioni commented 8 years ago

Thank you @omab!