You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal error: Uncaught bandwidthThrottle\tokenBucket\storage\StorageException:
The string is not 64 bit long. in \bandwidth-throttle\token-bucket\classes\util\DoublePacker.php: 41
Having this error when applied following code in constructor of ApiController, and tried to use consume:
`function __construct() {
$this->storage = new FileStorage(__DIR__ . "/api.bucket");
$this->rate = new Rate(10, Rate::SECOND);
$this->bucket = new TokenBucket(10, $this->rate, $this->storage);
//Following code executed once, then commented
//$this->bucket->bootstrap(10);
}`
`protected function checkRateLimit() {
if (!$this->bucket->consume(1, $seconds)) {
http_response_code(429);
header(sprintf("Retry-After: %d", floor($seconds)));
exit();
}
//echo "Continue to API response";
return true;
}`
I have also noticed FileStorage class is sending blank string to unpack( ) function in Double Packer on line 129.
Fatal error: Uncaught bandwidthThrottle\tokenBucket\storage\StorageException:
The string is not 64 bit long. in \bandwidth-throttle\token-bucket\classes\util\DoublePacker.php: 41
Having this error when applied following code in constructor of ApiController, and tried to use consume:
`function __construct() {
}`
`protected function checkRateLimit() {
}`
I have also noticed FileStorage class is sending blank string to unpack( ) function in Double Packer on line 129.
bandwidthThrottle\tokenBucket\util\DoublePacker: :unpack('')
Please guide what's going wrong here?
The text was updated successfully, but these errors were encountered: