Import/calculations improvements
This commit is contained in:
@@ -24,7 +24,8 @@ async function importDailyDeals(prodConnection, localConnection) {
|
||||
const startTime = Date.now();
|
||||
|
||||
try {
|
||||
await localConnection.query('BEGIN');
|
||||
// Wrapper's beginTransaction() pins a dedicated client; query('BEGIN') would not.
|
||||
await localConnection.beginTransaction();
|
||||
|
||||
// Fetch recent daily deals from production (MySQL 5.7, no CTEs)
|
||||
// Join product_current_prices to get the actual deal price
|
||||
@@ -127,7 +128,7 @@ async function importDailyDeals(prodConnection, localConnection) {
|
||||
last_sync_timestamp = NOW()
|
||||
`);
|
||||
|
||||
await localConnection.query('COMMIT');
|
||||
await localConnection.commit();
|
||||
|
||||
outputProgress({
|
||||
status: "complete",
|
||||
@@ -149,7 +150,7 @@ async function importDailyDeals(prodConnection, localConnection) {
|
||||
console.error("Error importing daily deals:", error);
|
||||
|
||||
try {
|
||||
await localConnection.query('ROLLBACK');
|
||||
await localConnection.rollback();
|
||||
} catch (rollbackError) {
|
||||
console.error("Error during rollback:", rollbackError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user