Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

Commit 98bca84

Browse files
committed
Merge pull request #14 from esion/fix_throttle
wait a lil' bit more between two calls
2 parents d9fdb2f + 9200258 commit 98bca84

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/Discogs/Service.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,14 @@ protected function call($path, array $parameters = array())
264264
$rawData = $this->client->convertResponse($json);
265265
} else {
266266
if ($this->isEnableThrottle) {
267-
$timestamp = round(microtime(true) * 1000);
267+
$timestamp = floor(microtime(true) * 1000);
268268
$wait = static::$lastApiRequest + 1000000 - $timestamp;
269269

270270
if ($wait > 0) {
271271
usleep($wait);
272272
}
273273

274-
static::$lastApiRequest = round(microtime(true) * 1000);
274+
static::$lastApiRequest = ceil(microtime(true) * 1000);
275275
}
276276

277277
$rawData = $this->client->call($path, $parameters);

0 commit comments

Comments
 (0)