UIDGenerator: Remove the clock skew problem
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 4 Oct 2018 00:38:45 +0000 (01:38 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 4 Oct 2018 19:08:44 +0000 (20:08 +0100)
commite1d7271e42f57190a1a6de0cd45de3f6fcc775ee
treea7109e35954adae92a5ac9efa5f0cf0640b5fe6b
parentf340c7271c020090e19e7dd5be1c68a2c02dcc33
UIDGenerator: Remove the clock skew problem

In a nutshell:

This commmit removes the use of drifting microtime()
in favour of non-drifting time(). Then, we increase the size of
the counter by x1000, and consider every 1000 increments as 1ms
for the purposes of UUID.

Why:

This means we eliminate the whole code that can produce a fatal
exception when the clock drifts by more than we can wait for,
which puts us in a logical conundrum we can't get out of, hence
it previously fatalled.

Not aborting random end-user requests and jobs is good.

This also means we avoid the vast majority of cases where
MediaWiki would busy-loop for upto 10ms in a likely-to-fail
attempt to sync the clock. This means the method runs faster,
which is a nice win, albeit not the main objective.

Bug: T94522
Change-Id: Ia8a847078ec76d633854db6823a20f0961c80f80
includes/utils/UIDGenerator.php