Repository navigation
Fix random IDs - #6302
Fix random IDs#6302Dreamsorcerer wants to merge 8 commits into
Conversation
|
Appears this fails to fix the issue. Looks like all the python examples consistently get to: But, sometimes aiohttp comes out at 10126, which then fails the test. I suspect this is because of the random value being set. When we update the values, we pick a random number between 0-10000 and update the object. If that number is the same as the previously set number, then I'd expect sqlalchemy to drop the update statement again (as it achieves nothing). Judging by the above test runs, I'd say it has a little over 50% chance of failing. |
|
@nbrady-techempower ^^^ |
|
Running the maths, there should be only a 36% chance that 0 collisions happen and the test succeeds. |
There needs to be a mechanism in place that replenishes this array with a new set of randomly ordered numbers in the event is it exhausted.
It may be worthwhile to wait a few days. We're still in the process of switching over to the new toolset and this might give you more insight into what's happening. |
The current code just reuses the beginning of the array every time. So, multiple requests would get the same set of IDs. So, my question is more does it have to be shuffled on every request to give a different set of ids (or is once per application startup enough)?
Given the frequency, my theory that it is caused by the random number matching the existing value in the DB seems pretty likely. If a single update is missing, the test fails. |
Yes, it needs to be randomized on each request. |
|
Hey @Dreamsorcerer ! It's been a bit since we talked about this. Any time to take a look at it or should I close it up for now? |
|
Well, I don't know how to fix the issue, as I mentioned before the tests should probably fail with about a 64% chance. I'm not sure if there's maybe some option to sqlalchemy or something that could disable the optimisations, otherwise I don't see a fix. Feel free to close the PR given that it doesn't resolve the issue. |
Avoid duplicate IDs in Python tests.
Is it permittable to randomise it once at the top of the file, and avoid doing any random functions within the handlers?