javalent / dice-roller

Inline dice rolling for Obsidian.md
274 stars 28 forks source link

Many Dice-Mod applications cause race condition to edit the file. #115

Closed HAJ523 closed 2 years ago

HAJ523 commented 2 years ago

If you have many dice-mod apply at the same time the obsidian/ the file freaks out and does many many rolls instead of just the one required for each dice-mod. (If there are too many it appears that it can enter an infinite loop of editing the file which forces you to close obsidian to be able to modify the file again. (Can also get errors like file modified outside of obsidian process during this freakout.)

Template Example:

NPC

Gender: dice-mod: [[Generic^GenderList]] Interest:dice-mod: [[Generic^Interest]] Race: dice-mod: [[Generic^Race]] Descriptors: dice-mod: [[Ironsworn^DescriptorList]], dice-mod: [[Ironsworn^DescriptorList]], dice-mod: [[Ironsworn^DescriptorList]]

I can provide tables if that would help for all of the above. Note that the Race roll is a table that breaks out into many tables like mentioned in issue 112

JYCasalis commented 2 years ago

@HAJ523 Please check issue #116 you might find interesting things there 😉

JYCasalis commented 2 years ago

This should be fixed with my latest push @HAJ523 (in my PR under review). The number of read / write operations was factorial(number of dice-mod blocks)... (a lot very quickly as you noticed). Now it is... one 😎

HAJ523 commented 2 years ago

Fixed with 8.5.0