0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Merge pull request #4327 from dbolack-ab/fallbackTest

Run patch processing in parallel to prior system
This commit is contained in:
Trevor Buckner
2025-07-10 09:50:43 -04:00
committed by GitHub
5 changed files with 23 additions and 10 deletions

View File

@@ -88,6 +88,14 @@ pre {
## changelog
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
### Wednesday 7/09/2025 - v3.19.3
{{taskList
##### calculuschild
* [x] Restoring original saving behavior; will continue investigating why save was failing for some users in background
}}
### Wednesday 7/09/2025 - v3.19.2
{{taskList

View File

@@ -265,7 +265,7 @@ const EditPage = createClass({
brew.pageCount = ((brew.renderer=='legacy' ? brew.text.match(/\\page/g) : brew.text.match(/^\\page$/gm)) || []).length + 1;
brew.patches = stringifyPatches(makePatches(this.savedBrew.text, brew.text));
brew.hash = await md5(this.savedBrew.text);
brew.text = undefined;
//brew.text = undefined; - Temporary parallel path
brew.textBin = undefined;
const transfer = this.state.saveGoogle == _.isNil(this.state.brew.googleId);

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "homebrewery",
"version": "3.19.2",
"version": "3.19.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "homebrewery",
"version": "3.19.2",
"version": "3.19.3",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View File

@@ -1,7 +1,7 @@
{
"name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown",
"version": "3.19.2",
"version": "3.19.3",
"type": "module",
"engines": {
"npm": "^10.8.x",
@@ -72,7 +72,7 @@
"lines": 50
},
"server/homebrew.api.js": {
"statements": 69,
"statements": 60,
"branches": 50,
"functions": 65,
"lines": 70

View File

@@ -340,7 +340,7 @@ const api = {
const brewFromClient = api.excludePropsFromUpdate(req.body);
const brewFromServer = req.brew;
splitTextStyleAndMetadata(brewFromServer);
brewFromServer.text = brewFromServer.text.normalize();
brewFromServer.hash = await md5(brewFromServer.text);
@@ -357,15 +357,20 @@ const api = {
let brew = _.assign(brewFromServer, brewFromClient);
brew.title = brew.title.trim();
brew.description = brew.description.trim() || '';
try {
const patches = parsePatch(brewFromClient.patches);
brew.text = applyPatches(patches, brewFromServer.text)[0];
// Patch to a throwaway variable while parallelizing - we're more concerned with error/no error.
const patchedResult = applyPatches(patches, brewFromServer.text)[0];
// brew.text = applyPatches(patches, brewFromServer.text)[0];
} catch (err) {
console.error('Failed to apply patches:', {
patches: brewFromClient.patches,
brewId: brew.editId || 'unknown'
patches : brewFromClient.patches,
brewId : brew.editId || 'unknown',
error : err
});
throw err; // rethrow to preserve the 500 behavior
// While running in parallel, don't throw the error upstream.
// throw err; // rethrow to preserve the 500 behavior
}
brew.text = api.mergeBrewText(brew);