Describe the bug
A race condition can cause game.settings.set("sequencer", "welcome-shown", true) to error and not update the setting, which causes the Sequencer welcome message to be displayed every time a GM logs in.
In Foundry, a world level setting cannot be set if the game is not ready.
It is possible for the sequencer.ready hook to be called before the ready hook (before game.ready), possibly due to it being hooked onto multiple triggers, possibly due to network conditions or other factors not commonly encountered in a self-hosting environment.
To Reproduce
Difficult to reproduce, due to race condition. Requires a large world and specific network conditions.
Expected behaviorgame.settings.set("sequencer", "welcome-shown", true) should happen after game.ready.
Additional context
This issue was reported to Forge support.
On Forge on small worlds, game.ready is true when game.settings.set is called, and there is no issue.
On Forge on a specific user's pf2e world which has a fair amount of data, the race condition was observed.
That said, the user who was encountering this before said that their issue was resolved in 3.2.1, so it might be possible that I am mistaken.
If that is the case, please accept my apologies and feel free to close the issue!
Describe the bug A race condition can cause
game.settings.set("sequencer", "welcome-shown", true)
to error and not update the setting, which causes the Sequencer welcome message to be displayed every time a GM logs in.Relates to code around https://github.com/fantasycalendar/FoundryVTT-Sequencer/blob/master/src/module.js#L148
In Foundry, a world level setting cannot be set if the game is not ready. It is possible for the
sequencer.ready
hook to be called before theready
hook (beforegame.ready
), possibly due to it being hooked onto multiple triggers, possibly due to network conditions or other factors not commonly encountered in a self-hosting environment.To Reproduce Difficult to reproduce, due to race condition. Requires a large world and specific network conditions.
Expected behavior
game.settings.set("sequencer", "welcome-shown", true)
should happen aftergame.ready
.If
game.ready
isfalse
at https://github.com/fantasycalendar/FoundryVTT-Sequencer/blob/master/src/module.js#L148, there could be aHooks.once('ready', ()=> ...)
to schedule the settings.set to happen only after the ready hook has fired, ensuring FoundryScreenshots
Setup:
Active modules:
Additional context This issue was reported to Forge support. On Forge on small worlds,
game.ready
is true whengame.settings.set
is called, and there is no issue. On Forge on a specific user's pf2e world which has a fair amount of data, the race condition was observed.I believe https://github.com/fantasycalendar/FoundryVTT-Sequencer/commit/604256820c2b3f933489d402e531b6ebfb139684 was implemented as a fix, but I suspect that async/await is not the issue, and I wanted to bring the
game.ready
behaviour I saw while investigating to your attention.That said, the user who was encountering this before said that their issue was resolved in 3.2.1, so it might be possible that I am mistaken. If that is the case, please accept my apologies and feel free to close the issue!
console-export-2024-6-18_0-54-43.txt