Pricing updates
This commit is contained in:
@@ -76,7 +76,8 @@ namespace PartSource.Automation.Jobs
|
||||
|
||||
try
|
||||
{
|
||||
_shopifyClient.BulkActions.Add(new Metafield
|
||||
|
||||
await _shopifyClient.Metafields.Add(new Metafield
|
||||
{
|
||||
Namespace = "Pricing",
|
||||
Key = "CorePrice",
|
||||
@@ -85,24 +86,16 @@ namespace PartSource.Automation.Jobs
|
||||
OwnerResource = "product",
|
||||
OwnerId = product.Id
|
||||
});
|
||||
|
||||
await _shopifyClient.Products.Update(product);
|
||||
|
||||
_logger.LogInformation("Updated product id {productId}", product.Id);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, $"Failed to update pricing for product ID {product.Id}");
|
||||
_logger.LogWarning(ex, "Failed to update pricing for product ID {productId}", product.Id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_shopifyClient.BulkActions.Update(product);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, $"Failed to update pricing for product ID {product.Id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,14 +112,9 @@ namespace PartSource.Automation.Jobs
|
||||
_logger.LogWarning(ex, "Failed to get the next set of products. Retrying");
|
||||
products = await _shopifyClient.Products.GetPrevious();
|
||||
}
|
||||
}
|
||||
|
||||
while (_shopifyClient.BulkActions.PendingCount() > 0)
|
||||
{
|
||||
await Task.Delay(15 * 1000, token);
|
||||
_logger.LogInformation(_shopifyClient.BulkActions.PendingCount().ToString());
|
||||
_emailService.Send("Pricing Update Completed", $"The pricing update has completed.");
|
||||
}
|
||||
// _emailService.Send("Pricing Update Completed", $"The pricing update has completed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user