mirror of https://github.com/calzoneman/sync.git
Fix an issue where one broken channel can prevent others from saving
Son of a bitch.
This commit is contained in:
parent
b0daa58874
commit
31880fa625
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "3.25.2",
|
"version": "3.26.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -77,10 +77,11 @@ export class DatabaseStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalSize > SIZE_LIMIT) {
|
if (totalSize > SIZE_LIMIT) {
|
||||||
throw new ChannelStateSizeError('Channel state size is too large', {
|
return Promise.reject(new ChannelStateSizeError(
|
||||||
|
'Channel state size is too large', {
|
||||||
limit: SIZE_LIMIT,
|
limit: SIZE_LIMIT,
|
||||||
actual: totalSize
|
actual: totalSize
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return queryAsync(buildUpdateQuery(rowCount), substitutions);
|
return queryAsync(buildUpdateQuery(rowCount), substitutions);
|
||||||
|
|
|
@ -20,10 +20,11 @@ export class FileStore {
|
||||||
const filename = this.filenameForChannel(channelName);
|
const filename = this.filenameForChannel(channelName);
|
||||||
return statAsync(filename).then(stats => {
|
return statAsync(filename).then(stats => {
|
||||||
if (stats.size > SIZE_LIMIT) {
|
if (stats.size > SIZE_LIMIT) {
|
||||||
throw new ChannelStateSizeError('Channel state file is too large', {
|
return Promise.reject(
|
||||||
|
new ChannelStateSizeError('Channel state file is too large', {
|
||||||
limit: SIZE_LIMIT,
|
limit: SIZE_LIMIT,
|
||||||
actual: stats.size
|
actual: stats.size
|
||||||
});
|
}));
|
||||||
} else {
|
} else {
|
||||||
return readFileAsync(filename);
|
return readFileAsync(filename);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +32,7 @@ export class FileStore {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(fileContents);
|
return JSON.parse(fileContents);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error('Channel state file is not valid JSON: ' + e);
|
return Promise.reject(new Error('Channel state file is not valid JSON: ' + e));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue