timout fx
This commit is contained in:
parent
ad4c216c75
commit
dc42eda2fe
|
|
@ -1,6 +1,7 @@
|
|||
package gorm_models
|
||||
|
||||
import (
|
||||
"context"
|
||||
helper "db_service/pkg"
|
||||
"gorm.io/gorm"
|
||||
"os"
|
||||
|
|
@ -94,9 +95,10 @@ func (ProductFlat) TableName() string {
|
|||
|
||||
func DeleteProducts(db *gorm.DB) error {
|
||||
//todo delete from elastico
|
||||
|
||||
return db.Exec("DELETE p.* FROM products p, order_items oi WHERE p.id NOT IN (select product_id from wishlist) AND p.id NOT IN (select product_id from order_items) AND p.id NOT IN (select parent_id from order_items)").Error
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
|
||||
defer cancel()
|
||||
qb := "DELETE p.* FROM products p, order_items oi WHERE p.id NOT IN (select product_id from wishlist) AND p.id NOT IN (select product_id from order_items) AND p.id NOT IN (select parent_id from order_items)"
|
||||
return db.WithContext(ctx).Exec(qb).Error
|
||||
}
|
||||
|
||||
func Flush() error {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import (
|
|||
func SendRequest(method string, endpoint string, values []byte, authKey string, isCouchDbReq bool) ([]byte, error) {
|
||||
|
||||
const ConnectMaxWaitTime = 30 * time.Second
|
||||
const RequestMaxWaitTime = 60 * time.Second
|
||||
const RequestMaxWaitTime = 10 * time.Minute
|
||||
|
||||
client := http.Client{
|
||||
Transport: &http.Transport{
|
||||
|
|
|
|||
Loading…
Reference in New Issue