Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-04-04 19:04:59 +03:00
parent 6467017470
commit b1a3bbd3c5
5 changed files with 110 additions and 9 deletions

View File

@@ -210,7 +210,9 @@ func InsertMissingVariantsTx(
username string,
cdItemByCode map[string]models.OrderProductionCdItemDraft,
) (int64, error) {
start := time.Now()
if len(missing) == 0 {
log.Printf("[InsertMissingVariantsTx] missing=0 inserted=0 duration_ms=0")
return 0, nil
}
@@ -332,6 +334,8 @@ WHERE pv.ItemCode IS NULL;
if rows, rowsErr := res.RowsAffected(); rowsErr == nil {
inserted += rows
}
log.Printf("[InsertMissingVariantsTx] missing=%d unique=%d ensuredItems=%d inserted=%d duration_ms=%d",
len(missing), len(uniqueVariants), len(ensuredItems), inserted, time.Since(start).Milliseconds())
return inserted, nil
}
@@ -571,7 +575,9 @@ WHERE l.OrderHeaderID = @p%d;
}
func UpsertItemAttributesTx(tx *sql.Tx, attrs []models.OrderProductionItemAttributeRow, username string) (int64, error) {
start := time.Now()
if len(attrs) == 0 {
log.Printf("[UpsertItemAttributesTx] attrs=0 affected=0 duration_ms=0")
return 0, nil
}
@@ -658,7 +664,11 @@ SELECT (@updated + @inserted) AS Affected;
return affected, err
}
affected += chunkAffected
log.Printf("[UpsertItemAttributesTx] chunk=%d-%d chunkAffected=%d cumulative=%d",
i, end, chunkAffected, affected)
}
log.Printf("[UpsertItemAttributesTx] attrs=%d affected=%d duration_ms=%d",
len(attrs), affected, time.Since(start).Milliseconds())
return affected, nil
}