Quick fix

This commit is contained in:
Gregory Schier
2016-12-31 11:32:50 -08:00
parent ac5fc055db
commit dfd93bd04c
2 changed files with 21 additions and 15 deletions

View File

@@ -52,21 +52,27 @@ export async function init (types, config = {}, forceReset = false) {
const filePath = getDBFilePath(modelType);
const MBs = fs.statSync(filePath).size / 1024 / 1024;
if (modelType === models.response.type && MBs > 256) {
// NOTE: Node.js can't have a string longer than 256MB. Since the response DB can reach
// sizes that big, let's not even load it if it's bigger than that. Just start over.
console.warn(`Response DB too big (${MBs}). Deleting...`);
fs.unlinkSync(filePath);
// Check to make sure the responses DB file isn't too big to parse. If it is, we
// should delete it
try {
const MBs = fs.statSync(filePath).size / 1024 / 1024;
if (modelType === models.response.type && MBs > 256) {
// NOTE: Node.js can't have a string longer than 256MB. Since the response DB can reach
// sizes that big, let's not even load it if it's bigger than that. Just start over.
console.warn(`Response DB too big (${MBs}). Deleting...`);
fs.unlinkSync(filePath);
// Can't show alert until the app renders, so delay for a bit first
setTimeout(() => {
showModal(AlertModal, {
title: 'Response DB Too Large',
message: 'Your combined responses have exceeded 256MB and have been flushed. ' +
'NOTE: A better solution to this will be implemented in a future release.'
});
}, 1000);
// Can't show alert until the app renders, so delay for a bit first
setTimeout(() => {
showModal(AlertModal, {
title: 'Response DB Too Large',
message: 'Your combined responses have exceeded 256MB and have been flushed. ' +
'NOTE: A better solution to this will be implemented in a future release.'
});
}, 1000);
}
} catch (err) {
// File probably did not exist probably, so no big deal
}
db[modelType] = new NeDB(Object.assign({

View File

@@ -27,7 +27,7 @@ class RequestActionsDropdown extends Component {
title: 'Advanced Sending',
message: (
<div>
For advanced sending options, hold <code>{MOD_SYM}</code> while
For advanced sending options, hold <code>{MOD_SYM.replace('+', '')}</code> while
clicking the send button next to the Url.
</div>
)