Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds concurrent_insurance_buy go script #155

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

Justintime50
Copy link
Member

@Justintime50 Justintime50 commented Aug 19, 2024

This tool allows a user to purchase insurance (EasyPost shipment or standalone insurance) in bulk by supplying a CSV file with tracking codes. We take in the CSV, prep and validate the data, spin up 20 goroutines concurrently to make requests fast, and await the entire CSV to finish processing before writing an output CSV to disk that contains the status of each request, the time it took, and any error messages. An example of the output can be seen here:

$ EASYPOST_API_KEY=123 CSV=sample.csv ./bulkins
Sending request for EZ7000000007...
Sending request for EZ2000000002...
Sending request for EZ3000000003...
Sending request for EZ1000000001...
Sending request for EZ5000000005...
Sending request for EZ4000000004...
Sending request for EZ6000000006...

Total time elapsed: 663.889417ms

Screenshot 2024-08-19 at 4 22 36 PM

@Justintime50 Justintime50 marked this pull request as ready for review August 20, 2024 20:53
@Justintime50 Justintime50 requested a review from a team as a code owner August 20, 2024 20:53
@Justintime50 Justintime50 merged commit cba0d0c into master Aug 21, 2024
9 checks passed
@Justintime50 Justintime50 deleted the concurrent_insurance_buy branch August 21, 2024 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants