A running example of the code from:
- http://marcio.io/2015/07/handling-1-million-requests-per-minute-with-golang
- http://nesv.github.io/golang/2014/02/25/worker-queues-in-go.html
Small refactorings made to original code:
| ### READ ME :::) | |
| # You can fetch issues with highest frequeny from sentry using this script. | |
| # It will fetch top 100 issues and some meta information related to that issue. | |
| # And write everything is a csv file separated with "~" | |
| # you can change environment=production in the URL used to make api call below. Please refer your project to see environment options available. | |
| #### IMPO :: please change token and your organization URL/Project_Name (org_and_project) below : | |
| import json | |
| import requests | |
| import csv |
| ############ REQUIREMENTS #################### | |
| # sudo apt-get install python-pip | |
| # sudo apt-get install libpq-dev | |
| # sudo pip install psycopg2 | |
| # sudo pip install sqlalchemy | |
| # sudo pip install sqlalchemy-redshift | |
| ############################################## | |
| import sqlalchemy as sa | |
| from sqlalchemy.orm import sessionmaker |
| Using MongoDB in golang with mgo |
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "gopkg.in/mgo.v2" | |
| "gopkg.in/mgo.v2/bson" | |
| "log" | |
| ) |
A running example of the code from:
Small refactorings made to original code:
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "github.com/varver/rextro" | |
| _ "golang.org/x/image/bmp" | |
| _ "golang.org/x/image/webp" | |
| "image" | |
| _ "image/gif" |
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| func decorator(f func(s string)) func(s string) { | |
| return func(s string) { | |
| fmt.Println("Started") |
| package main | |
| import ( | |
| "fmt" | |
| "runtime" | |
| "sync" | |
| "github.com/davecheney/profile" | |
| ) | |
| func main() { |
| package main | |
| import ( | |
| "os" | |
| "encoding/xml" | |
| "strings" | |
| "log" | |
| "runtime/debug" | |
| ) |