-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(monitoring): fix listing outdated errored conduits (#261)
* fix(monitoring): fix listing oudated errored conduits * fix * refact * fix * refact * fix * fix * fix * fix * remove comment * migration * bum version * more tests * more tests * bump version * shutdown error when migration fails * better ShutDownSignal * pr comments * add limit test * errMessage * remove version bump
- Loading branch information
1 parent
6f04076
commit c046dac
Showing
15 changed files
with
390 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export class ShutDownSignal extends Error { | ||
constructor() { | ||
constructor(public readonly code?: number) { | ||
super() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,5 @@ export interface Conduit { | |
id: uuid | ||
providerId: uuid | ||
channelId: uuid | ||
initialized: Date | undefined | ||
config: any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Migration } from '@botpress/messaging-engine' | ||
|
||
export class StatusMigration extends Migration { | ||
meta = { | ||
name: StatusMigration.name, | ||
description: 'Moves status information from conduit table to the status table', | ||
version: '0.1.19' | ||
} | ||
|
||
async valid() { | ||
return this.trx.schema.hasTable('msg_conduits') | ||
} | ||
|
||
async applied() { | ||
return !(await this.trx.schema.hasColumn('msg_conduits', 'initialized')) | ||
} | ||
|
||
async up() { | ||
await this.trx.schema.dropTableIfExists('msg_status') | ||
|
||
return this.trx.schema.alterTable('msg_conduits', (table) => { | ||
table.dropIndex(['initialized']) | ||
table.dropColumn('initialized') | ||
}) | ||
} | ||
|
||
async down() { | ||
await this.trx.schema.dropTableIfExists('msg_status') | ||
|
||
return this.trx.schema.alterTable('msg_conduits', (table) => { | ||
table.timestamp('initialized').nullable() | ||
table.index(['initialized']) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { Migration } from '@botpress/messaging-engine' | ||
import { StatusMigration } from './0.1.18-status' | ||
|
||
export const Migrations = [] as { new (): Migration }[] | ||
export const Migrations: { new (): Migration }[] = [StatusMigration] |
Oops, something went wrong.