Commit dc9b213a authored by nanahira's avatar nanahira

use native commands

parent 1b3ed035
Pipeline #881 passed with stages
in 6 minutes and 25 seconds
...@@ -77,7 +77,8 @@ export class SMBReader { ...@@ -77,7 +77,8 @@ export class SMBReader {
this.log.debug(`File ${filePath} has already been read. Skipping.`); this.log.debug(`File ${filePath} has already been read. Skipping.`);
continue; continue;
} }
await db.query("begin"); await db.query("set autocommit=0");
await db.beginTransaction();
this.log.info(`Reading file ${filePath}...`); this.log.info(`Reading file ${filePath}...`);
const fileMetadata = await db.query("insert into `filesRead` set ?", { const fileMetadata = await db.query("insert into `filesRead` set ?", {
filename: file.name, filename: file.name,
...@@ -119,9 +120,9 @@ export class SMBReader { ...@@ -119,9 +120,9 @@ export class SMBReader {
this.log.debug(`Failed deleting file ${deleteFilePath}:`, e.toString()); this.log.debug(`Failed deleting file ${deleteFilePath}:`, e.toString());
} }
} }
await db.query("commit"); await db.commit();
} catch (e) { } catch (e) {
await db.query("rollback"); await db.rollback();
this.log.warn(`Errored reading file ${filePath}:`, e.toString()); this.log.warn(`Errored reading file ${filePath}:`, e.toString());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment