test real baza
This commit is contained in:
parent
73941daf44
commit
e8910eca48
20
main.go
20
main.go
|
|
@ -71,8 +71,8 @@ func main() {
|
|||
|
||||
func worker(db *gorm.DB, stopCh <-chan struct{}, updatePeriod time.Duration) {
|
||||
importer, _ := repositories.ParseImporterInstance(db)
|
||||
ticker := time.NewTicker(time.Second)
|
||||
ticker = time.NewTicker(updatePeriod)
|
||||
|
||||
ticker := time.NewTicker(updatePeriod)
|
||||
defer ticker.Stop()
|
||||
log.Printf("Updater worker Started")
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ func worker(db *gorm.DB, stopCh <-chan struct{}, updatePeriod time.Duration) {
|
|||
continue
|
||||
} else {
|
||||
log.Println(len(result))
|
||||
continue
|
||||
|
||||
}
|
||||
|
||||
// Update products as needed
|
||||
|
|
@ -105,13 +105,19 @@ func worker(db *gorm.DB, stopCh <-chan struct{}, updatePeriod time.Duration) {
|
|||
|
||||
jsonProduct, err := parser.GetProductDetailWithOptions(data.ID, data.ProductGroupID)
|
||||
|
||||
// Update the product in the database
|
||||
if err := importer.UpdateOrCreate(jsonProduct).Error; err != nil {
|
||||
log.Println("Error decoding product information:", err)
|
||||
if err != nil {
|
||||
log.Println("Error getting product information:", err)
|
||||
continue
|
||||
}
|
||||
|
||||
log.Printf("Product %d updated: %+v\n", product.ID, product)
|
||||
log.Printf("Product %d updated: %+v\n", product.ID, jsonProduct)
|
||||
// Update the product in the database
|
||||
//if err := importer.UpdateOrCreate(jsonProduct).Error; err != nil {
|
||||
// log.Println("Error decoding product information:", err)
|
||||
// continue
|
||||
//}
|
||||
//
|
||||
//log.Printf("Product %d updated: %+v\n", product.ID, product)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue