-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About the next_short_code
function
#15
Comments
@Hu1-Li I see where this issue is coming from. Ordering the links by created_at desc and then picking the top link as latest will cause this. As for high load websites with many concurrent requests at a time will have many rows with the same created_at time. Wrong ordering is causing while loop and eventually This can be fixed by ordering by I am bit busy right now, I will fix and test this when I get some time. Would you like to make necessary changes and the above tests and open a PR? |
OK, I will try. |
Update:
it got In Mysql, String compare is case-insensitive, thus, causing the server down ,since it needs to loop a really big cycle, from So when creating table, the field
In SQLAchemy, This can be achieved by
|
Pull request #17 fixes this problem, As for test, i get no idea how to achieve the test for the above problem @amitt001 // Update emmmm, |
Here is the simple test result, about function
next_short_code
As you can see, order by
link.created_at desc
is not always corect.And If using
link.created_at desc
will get the incorrect answer ofbase_str
, which will trapped into the while cycle.here is the log of simple call
next_short_code
, which iter fromh2k
toh2x
.If you want to re-appear this situation, write two script
next_short_code
I'm writing this because that we use this and it cause the server near down(can't login using ssh). Is this related?
The text was updated successfully, but these errors were encountered: