Skip to content
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

It is not possible to record more than one conversion per second for the same visit #13727

Merged
merged 3 commits into from Jan 22, 2019

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Nov 19, 2018

fix #9916

we randomize the first 2 numbers increasing the chances to record multiple goal conversions per second per visit.

…the same visit

fix #9916

we randomize the first 2 numbers increasing the chances to record multiple goal conversions per second per visit.
@tsteur tsteur added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Nov 19, 2018
@tsteur tsteur added this to the 3.9.0 milestone Nov 19, 2018
private function makeRandomMySqlUnsignedInt($length)
{
// mysql int unsgined max value is 4294967295 so we cannot start with a 5 or higher
return Common::getRandomString(1, '1234') . Common::getRandomString($length - 1, '0123456789');
Copy link
Member

Choose a reason for hiding this comment

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

But couldn't this still create to high values between 4294967296 and 4999999999

Copy link
Member Author

Choose a reason for hiding this comment

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

definitely, updated 👍

}
if ($length > 2) {
$randomInt .= Common::getRandomString($length - 2, '0123456789');
}
Copy link
Member

Choose a reason for hiding this comment

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

Actually even that could generate a too high number, even though the range is now much smaller between 4294967295 and 4299999999. Maybe it would be simpler to restrict the number to be between 1000000000 and 3999999999, e.g. disallow the 4 as first char?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, makes totally sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

changed it.

@diosmosis diosmosis merged commit 48e5531 into 3.x-dev Jan 22, 2019
@diosmosis diosmosis deleted the 9916 branch January 22, 2019 05:26
@mattab mattab modified the milestones: 3.9.0, 3.8.1 Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It is not possible to record more than one conversion per second for the same visit
4 participants