1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-08-08 22:36:41 +02:00

Add more comment

This commit is contained in:
huyng
2019-08-15 14:46:44 +07:00
committed by seta-davenguyen
parent 7171328072
commit c61a934279
2 changed files with 3 additions and 1 deletions

View File

@ -339,6 +339,8 @@ func GetGeonameCountry(ctx context.Context, country string) ([]Geoname, error) {
u := fmt.Sprintf("http://download.geonames.org/export/zip/%s.zip", country) u := fmt.Sprintf("http://download.geonames.org/export/zip/%s.zip", country)
resp, err = pester.Get(u) resp, err = pester.Get(u)
if err != nil { if err != nil {
// Add re-try three times after failing first time
// This reduces the risk when network is lagy, we still have chance to re-try.
for i := 0; i < 3; i++ { for i := 0; i < 3; i++ {
resp, err = pester.Get(u) resp, err = pester.Get(u)
if err == nil { if err == nil {

View File

@ -293,7 +293,7 @@ func migrationList(ctx context.Context, db *sqlx.DB, log *log.Logger, isUnittest
return errors.WithStack(err) return errors.WithStack(err)
} }
//fmt.Println("Geoname records: ", len(v)) //fmt.Println("Geoname records: ", len(v))
// Max argument values of Postgres is about 54460. So the batch size for bulk insert is selected 4500*12 (ncol)
batch := 4500 batch := 4500
n := len(v) / batch n := len(v) / batch