diff --git a/src/main/php/com-realexpayments-remote-sdk/utils/GenerationUtils.php b/src/main/php/com-realexpayments-remote-sdk/utils/GenerationUtils.php index 45ab81d..2bce70b 100644 --- a/src/main/php/com-realexpayments-remote-sdk/utils/GenerationUtils.php +++ b/src/main/php/com-realexpayments-remote-sdk/utils/GenerationUtils.php @@ -132,10 +132,15 @@ private static function getGuid() { } + private static $lastCall; + private static function pauseExecution() { - // pause the execution for 100 milliseconds to avoid name collission - // in case many ids are generated in one go - usleep( 100000 ); + if (self::$lastCall > microtime(TRUE) - 0.1) { + // pause the execution for 100 milliseconds to avoid name collission + // in case many ids are generated in one go + usleep( 100000 ); + } + self::$lastCall = microtime(TRUE); } -} \ No newline at end of file +}