Move to event-driven controller#13
Conversation
Make Controller an EventEmitter Rename 'failed' state to 'error'
|
In testing |
| // Callbacks can be promises | ||
| // eslint-disable-next-line @typescript-eslint/no-misused-promises | ||
| this.on('load', this.handleLoad) | ||
| this.on('reload', this.handleReload) |
Check failure
Code scanning / ESLint
Disallow Promises in places not designed to handle them Error
|
|
||
| // StartKoboldCpp starts koboldcpp executable and wait before it responds. | ||
| runKoboldCpp(args: KoboldCppArgs) { | ||
| private handleLoad = async (args: KoboldCppArgs) => { |
Check failure
Code scanning / ESLint
Disallow async functions which do not return promises and have no `await` expression Error
| this.aborter?.abort() | ||
|
|
||
| this.modelStatus.State = 'stopping' | ||
| this.waitForChildState('offline', modelStopTimeoutMs) |
Check failure
Code scanning / ESLint
Require Promise-like statements to be handled appropriately Error
| await sleep(waitItervalMs) | ||
|
|
||
| await waitForModel() | ||
| return await waitForModel() |
Check failure
Code scanning / ESLint
Require `return` statements to either always or never specify values Error
| await sleep(waitItervalMs) | ||
|
|
||
| await waitForModel() | ||
| return await waitForModel() |
Check failure
Code scanning / ESLint
Require expressions of type void to appear in statement position Error
Make
Controlleroperations event-basedRename
failedstate toerror