scoute flash api
This commit is contained in:
parent
29ee783bca
commit
f1fa071191
|
|
@ -101,7 +101,12 @@ func Start(w http.ResponseWriter, route *http.Request) {
|
|||
}
|
||||
|
||||
mainImportWG.Wait()
|
||||
err = gm.Flush()
|
||||
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
elapsed := time.Since(start)
|
||||
log.Printf("end import took %s", elapsed)
|
||||
|
||||
|
|
@ -117,7 +122,7 @@ func startImport(dbName string, db *gorm.DB) {
|
|||
|
||||
totalDocCount := getTotalDocumentCount(dbName)
|
||||
skip := 0
|
||||
limit := 100
|
||||
limit := 500
|
||||
|
||||
for skip < totalDocCount {
|
||||
|
||||
|
|
@ -195,7 +200,6 @@ func getCats(db *gorm.DB, catIDs []int) ([]gm.Category, string, error) {
|
|||
|
||||
keywords += "," + translation.MetaKeywords
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return categories, keywords, nil
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package gorm_models
|
||||
|
||||
import (
|
||||
helper "db_service/pkg"
|
||||
"gorm.io/gorm"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
@ -96,3 +98,9 @@ func DeleteProducts(db *gorm.DB) error {
|
|||
return db.Exec("DELETE p.* FROM products p, order_items oi,wishlist f WHERE oi.product_id != p.id AND oi.parent_id != p.id AND f.product_id != p.id").Error
|
||||
|
||||
}
|
||||
|
||||
func Flush() error {
|
||||
_, err := helper.SendRequest("GET", os.Getenv("couch_db_source"), nil, "", true)
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue