Import terms with transactional adds instead of bulkAdd

This commit is contained in:
Musee Ullah 2017-07-27 00:18:57 -07:00
parent 390cb12896
commit 1d5bdddfa6
No known key found for this signature in database
GPG Key ID: FAF190AD6EB56A44

View File

@ -189,9 +189,9 @@ class Database {
}; };
const termsLoaded = (title, entries, total, current) => { const termsLoaded = (title, entries, total, current) => {
const rows = []; return this.db.transaction('rw', this.db.terms, function() {
for (const [expression, reading, tags, rules, score, ...glossary] of entries) { for (const [expression, reading, tags, rules, score, ...glossary] of entries) {
rows.push({ this.db.terms.add({
expression, expression,
reading, reading,
tags, tags,
@ -201,8 +201,7 @@ class Database {
dictionary: title dictionary: title
}); });
} }
}).then(() => {
return this.db.terms.bulkAdd(rows).then(() => {
if (callback) { if (callback) {
callback(total, current); callback(total, current);
} }