Match items
storage format to Backbone adapter
This commit is contained in:
parent
7de7fcf561
commit
85788d3c4a
1 changed files with 3 additions and 3 deletions
|
@ -97,7 +97,7 @@ exports.processAll = async ({
|
||||||
let unprocessedMessages = [];
|
let unprocessedMessages = [];
|
||||||
do {
|
do {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const lastProcessedIndex = (await getLastProcessedIndex(connection)) || null;
|
const lastProcessedIndex = await getLastProcessedIndex(connection);
|
||||||
|
|
||||||
const fetchUnprocessedMessagesStartTime = Date.now();
|
const fetchUnprocessedMessagesStartTime = Date.now();
|
||||||
unprocessedMessages =
|
unprocessedMessages =
|
||||||
|
@ -284,7 +284,7 @@ const getItem = (connection, key) => {
|
||||||
reject(event.target.error);
|
reject(event.target.error);
|
||||||
|
|
||||||
request.onsuccess = event =>
|
request.onsuccess = event =>
|
||||||
resolve(event.target.result);
|
resolve(event.target.result ? event.target.result.value : null);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ const setItem = (connection, key, value) => {
|
||||||
|
|
||||||
const transaction = connection.transaction(ITEMS_STORE_NAME, 'readwrite');
|
const transaction = connection.transaction(ITEMS_STORE_NAME, 'readwrite');
|
||||||
const itemsStore = transaction.objectStore(ITEMS_STORE_NAME);
|
const itemsStore = transaction.objectStore(ITEMS_STORE_NAME);
|
||||||
const request = itemsStore.put(value, key);
|
const request = itemsStore.put({id: key, value}, key);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request.onerror = event =>
|
request.onerror = event =>
|
||||||
reject(event.target.error);
|
reject(event.target.error);
|
||||||
|
|
Loading…
Reference in a new issue