allow to skip item by created
This commit is contained in:
@ -899,6 +899,7 @@ func parseEwayDumpAction(ctx context.Context, cmd *cli.Command) error {
|
||||
fetchedInfo int
|
||||
handledAll int
|
||||
cachedInfo int
|
||||
skippedItem int
|
||||
}{}
|
||||
|
||||
startFrom := time.Now()
|
||||
@ -934,6 +935,14 @@ func parseEwayDumpAction(ctx context.Context, cmd *cli.Command) error {
|
||||
for _, item := range items {
|
||||
var pi entity.GoodsItemInfo
|
||||
seenItem := seenItems[item.SKU]
|
||||
if time.Since(seenItem.CreatedAt) < time.Hour*24 {
|
||||
logger.Debug().Str("sku", item.SKU).Msg("skipping item because it's too fresh")
|
||||
stats.skippedItem++
|
||||
itemsUpdated[item.SKU] = struct{}{}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if len(seenItem.Parameters) != 0 && len(seenItem.PhotoURLs) != 0 {
|
||||
pi.Parameters = seenItem.Parameters
|
||||
pi.PhotoURLs = seenItem.PhotoURLs
|
||||
@ -1015,6 +1024,7 @@ func parseEwayDumpAction(ctx context.Context, cmd *cli.Command) error {
|
||||
Int("handled", stats.handledAll).
|
||||
Int("cached", stats.cachedInfo).
|
||||
Int("fetched", stats.fetchedInfo).
|
||||
Int("skipped", stats.skippedItem).
|
||||
Int("to_delete", len(seenItems)).
|
||||
Msg("processed items")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user