fix(cordis): make config reload transactional
This commit is contained in:
Vendored
+1
-1
@@ -334,7 +334,7 @@ export interface Events {
|
||||
/** Interception hook for a service binding (no core producer). */
|
||||
'internal/service'(this: Context, name: string, value: any): void
|
||||
/** Waterfall: a fiber config update is being applied; skip `next()` to veto. */
|
||||
'internal/update'(this: Fiber, config: any, noSave: boolean, next: () => void): void
|
||||
'internal/update'(this: Fiber, config: any, noSave: boolean, next: () => void | Promise<void>): void | Promise<void>
|
||||
/** Waterfall: a service is being read through the context proxy. */
|
||||
'internal/get'(ctx: Context, name: string, error: Error, next: () => any): any
|
||||
/** Waterfall: a service is being written through the context proxy. */
|
||||
|
||||
Vendored
+3
-3
@@ -728,13 +728,13 @@ export class Fiber {
|
||||
*
|
||||
* @param config — the new raw config; validated before anything restarts.
|
||||
* @param noSave — hint for persistence hooks not to write the change back.
|
||||
* @returns nothing; the restart runs behind the `internal/update` waterfall.
|
||||
* @throws {ValidationError} when the new config fails validation.
|
||||
* @returns the update waterfall result; the default restart returns a promise.
|
||||
* @throws when validation, an update listener, or the restarted plugin fails.
|
||||
*/
|
||||
update(config: any, noSave = false) {
|
||||
this.assertActive()
|
||||
config = resolveConfig(this.runtime!, config)
|
||||
this.context.waterfall(this, 'internal/update', config, noSave, () => {
|
||||
return this.context.waterfall(this, 'internal/update', config, noSave, () => {
|
||||
this.config = config
|
||||
this._error = undefined
|
||||
return this.restart()
|
||||
|
||||
Reference in New Issue
Block a user