Skip to content

Commit 88ed7be

Browse files
feat(core): Enable insights for sqlite legacy (#14606)
1 parent 6b344f8 commit 88ed7be

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

packages/cli/src/modules/insights/__tests__/insights.pre-init.test.ts

+3-19
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,13 @@ describe('InsightsModulePreInit', () => {
1010
it('should return false if instance type is not "main"', () => {
1111
const ctx: ModulePreInitContext = {
1212
instance: mock<InstanceSettings>({ instanceType: 'worker' }),
13-
database: mock<DatabaseConfig>({ type: 'sqlite', sqlite: { poolSize: 10 } }),
13+
database: mock<DatabaseConfig>({ type: 'sqlite' }),
1414
};
1515
expect(shouldLoadModule(ctx)).toBe(false);
1616
});
1717

18-
it('should return false if database type is "sqlite" and poolSize is < 1', () => {
19-
const ctx: ModulePreInitContext = {
20-
instance: mock<InstanceSettings>({ instanceType: 'main' }),
21-
database: mock<DatabaseConfig>({ type: 'sqlite', sqlite: { poolSize: 0 } }),
22-
};
23-
expect(shouldLoadModule(ctx)).toBe(false);
24-
});
25-
26-
it.each(['postgresdb', 'mariadb', 'mysqldb'])(
27-
'should return true if instance type is "main" and database is not sqlite',
18+
it.each(['postgresdb', 'mariadb', 'mysqldb', 'sqlite'])(
19+
'should return true if instance type is "main"',
2820
(dbType: 'postgresdb' | 'mysqldb' | 'sqlite' | 'mariadb') => {
2921
const ctx: ModulePreInitContext = {
3022
instance: mock<InstanceSettings>({ instanceType: 'main' }),
@@ -33,12 +25,4 @@ describe('InsightsModulePreInit', () => {
3325
expect(shouldLoadModule(ctx)).toBe(true);
3426
},
3527
);
36-
37-
it('should return true if instance type is "main" and sqlite poolSize is >= 1', () => {
38-
const ctx: ModulePreInitContext = {
39-
instance: mock<InstanceSettings>({ instanceType: 'main' }),
40-
database: mock<DatabaseConfig>({ type: 'sqlite', sqlite: { poolSize: 1 } }),
41-
};
42-
expect(shouldLoadModule(ctx)).toBe(true);
43-
});
4428
});

packages/cli/src/modules/insights/insights.pre-init.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@ import type { ModulePreInitContext } from '../modules.config';
33
export const shouldLoadModule = (ctx: ModulePreInitContext) =>
44
// Only main instance(s) should collect insights
55
// Because main instances are informed of all finished workflow executions, whatever the mode
6-
ctx.instance.instanceType === 'main' &&
7-
// This is because legacy sqlite (without pool) does not support nested transactions needed for insights
8-
// TODO: remove once benchmarks confirm this issue is solved with buffering / flushing mechanism
9-
(ctx.database.type !== 'sqlite' || ctx.database.sqlite.poolSize > 0);
6+
ctx.instance.instanceType === 'main';

0 commit comments

Comments
 (0)