kings1ay3r / bg-q

A versatile JavaScript/TypeScript library for managing server actions in sequence, especially when actions are interdependent. A flexible tool for complex workflows where actions depend on responses from prior actions.
2 stars 0 forks source link

[critical] bug: resolve disk read promise on boot to ensure consistency #3

Closed kings1ay3r closed 3 weeks ago

kings1ay3r commented 1 month ago

:warning: Potential issue

Avoid calling async methods in the constructor without handling completion

The loadFromPersistence method is asynchronous but is called in the constructor without awaiting its completion. This may lead to this.queue and this.dlQueue not being properly initialized when other methods are called.

Consider restructuring the initialization process. One approach is to remove the call to loadFromPersistence from the constructor and instead provide an asynchronous init method that must be called after instantiation.

Would you like assistance in refactoring the initialization process to ensure proper loading of persistent data?

_Originally posted by @coderabbitai[bot] in https://github.com/kings1ay3r/bg-q/pull/2#discussion_r1792258415_

Checkout all conversations in the PR. There are multiple conversations referencign the issue.

kings1ay3r commented 3 weeks ago

init is now an async function. await instance.ready for boot status!