Comparing these libraries
- github.com/google/uuid
- github.com/lucsky/cuid
- github.com/matoous/go-nanoid
APIs might implement rate limiting, and if they do your clients might experience 429 Too Many Requests
responses with a Retry-After
header, informing your client how long it should wait before making the next request. And being good internet citizens we should all implement support for this in our API clients.
Guzzle includes a retry middleware class that can be used to handle this.
The implementation in this gist is a PoC, so feel free to build upon it, and comment if you think something should be added / removed.
Commands | |
------------ | |
1. Build Docker Image | |
docker build -t test . | |
2. Run container /w image | |
docker run -d --publish 8888:5000 test | |
3. Login to ECR | |
aws ecr get-login-password --region REGIONHERE!!!! | docker login --username AWS --password-stdin ACCOUNTIDHERE!!!!.dkr.ecr.REGIONHERE!!!.amazonaws.com |
Install Supervisor with sudo apt-get install supervisor
in Unix or brew install supervisor
in Mac OSX. Ensure it's started with sudo service supervisor restart
in Unix or brew services start supervisor
in Mac OSX.
In Unix in /etc/supervisord/conf.d/
create a .conf
file. In this example, laravel_queue.conf
(contents below). Give it execute permissions: chmod +x laravel_queue.conf
.
In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini
and in /usr/local/etc/supervisor.d/
create a .conf
file. In this example, laravel_queue.conf
(contents below). Give it execute permissions: chmod +x laravel_queue.conf
.
This file points at /usr/local/bin/run_queue.sh
, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh
.
Now update Supervisor with: sudo supervisorctl reread
in Unix and with: brew services restart supervisor
in MAc OSX . And start using those changes with: sudo supervisorctl update
.
DROP TABLE currency; | |
-- Create table variable | |
CREATE TABLE currency ( | |
name VARCHAR(20), | |
code VARCHAR(3), | |
symbol VARCHAR(5) | |
); | |
ALTER TABLE currency CONVERT TO CHARACTER SET utf8; |