openstax / poet

VSCode Extension to edit OpenStax books
https://gitpod.io/#https://github.com/openstax/poet
GNU Affero General Public License v3.0
2 stars 5 forks source link

1796 fix infinite enqueue #197

Closed TylerZeroMaster closed 4 months ago

TylerZeroMaster commented 5 months ago

part of openstax/ce#1796

Background:

When parse error occurred, the node was not set to loaded (node.isLoaded and node.exists continued to return false)

Since these nodes were never considered loaded, they were re-enqueued for loading forever.

The immediate trigger for the problem was the BookValidationKind.MISSING_PAGE validation in book.ts requiring pages to be loaded to check if they exist.

The underlying issue is a much deeper problem related to the job queue. If too many jobs are enqueued in a short time, poet halts without error. When this occurs, poet must be reloaded.

Limiting re-enqueued nodesToLoad to those that do not have a parse error fixes the immediate issue.

I thought about isLoaded returning this._isLoaded.get() && this._parseError.get() === undefined potentially being a better long-term; however, because of the nature of the bug, I feared that isLoaded may have unintentionally become synonymous with isValid.