remove sleep parameter
sql query execution timeout now set to 1hr
This commit is contained in:
parent
3c274e8361
commit
f720f34bc7
@ -16,7 +16,6 @@ export default interface IConnectionOptions {
|
||||
| "sqlite";
|
||||
schemaName: string;
|
||||
ssl: boolean;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export function getDefaultConnectionOptions(): IConnectionOptions {
|
||||
@ -28,8 +27,7 @@ export function getDefaultConnectionOptions(): IConnectionOptions {
|
||||
password: "",
|
||||
databaseType: undefined as any,
|
||||
schemaName: "",
|
||||
ssl: false,
|
||||
timeout: undefined
|
||||
ssl: false
|
||||
};
|
||||
return connectionOptions;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ WHERE TABLE_TYPE='BASE TABLE' and TABLE_SCHEMA in (${schema}) AND TABLE_CATALOG
|
||||
},
|
||||
password: connectionOptons.password,
|
||||
port: connectionOptons.port,
|
||||
requestTimeout: connectionOptons.timeout,
|
||||
requestTimeout: 60 * 60 * 1000,
|
||||
server: connectionOptons.host,
|
||||
user: connectionOptons.user
|
||||
};
|
||||
|
@ -421,7 +421,7 @@ export default class MysqlDriver extends AbstractDriver {
|
||||
ssl: {
|
||||
rejectUnauthorized: false
|
||||
},
|
||||
timeout: connectionOptons.timeout,
|
||||
timeout: 60 * 60 * 1000,
|
||||
user: connectionOptons.user
|
||||
};
|
||||
} else {
|
||||
@ -430,7 +430,7 @@ export default class MysqlDriver extends AbstractDriver {
|
||||
host: connectionOptons.host,
|
||||
password: connectionOptons.password,
|
||||
port: connectionOptons.port,
|
||||
timeout: connectionOptons.timeout,
|
||||
timeout: 60 * 60 * 1000,
|
||||
user: connectionOptons.user
|
||||
};
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ export default class OracleDriver extends AbstractDriver {
|
||||
TABLE_NAME: string;
|
||||
DB_NAME: string;
|
||||
}[] = (await this.Connection.execute(
|
||||
` SELECT NULL AS TABLE_SCHEMA, TABLE_NAME, NULL AS DB_NAME FROM all_tables WHERE owner = (select user from dual)`
|
||||
`SELECT NULL AS TABLE_SCHEMA, TABLE_NAME, NULL AS DB_NAME FROM all_tables WHERE owner = (select user from dual)`
|
||||
)).rows!;
|
||||
return response;
|
||||
};
|
||||
|
@ -594,7 +594,7 @@ export default class PostgresDriver extends AbstractDriver {
|
||||
port: connectionOptons.port,
|
||||
ssl: connectionOptons.ssl,
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
statement_timeout: connectionOptons.timeout,
|
||||
statement_timeout: 60 * 60 * 1000,
|
||||
user: connectionOptons.user
|
||||
});
|
||||
|
||||
|
41
src/index.ts
41
src/index.ts
@ -81,14 +81,6 @@ function readTOMLConfig(
|
||||
hasUnknownProperties = true;
|
||||
}
|
||||
});
|
||||
if (
|
||||
!Object.prototype.hasOwnProperty.call(
|
||||
loadedConnectionOptions,
|
||||
"timeout"
|
||||
)
|
||||
) {
|
||||
loadedConnectionOptions.timeout = undefined;
|
||||
}
|
||||
}
|
||||
if (loadedGenerationOptions) {
|
||||
Object.keys(loadedGenerationOptions).forEach(key => {
|
||||
@ -251,11 +243,6 @@ function checkYargsParameters(options: options): options {
|
||||
choices: ["none", "?", "!"],
|
||||
default: options.generationOptions.strictMode,
|
||||
describe: "Mark fields as optional(?) or non-null(!)"
|
||||
},
|
||||
timeout: {
|
||||
describe: "SQL Query timeout(ms)",
|
||||
default: options.connectionOptions.timeout,
|
||||
number: true
|
||||
}
|
||||
});
|
||||
|
||||
@ -272,7 +259,6 @@ function checkYargsParameters(options: options): options {
|
||||
? argv.s.toString()
|
||||
: standardSchema;
|
||||
options.connectionOptions.ssl = argv.ssl;
|
||||
options.connectionOptions.timeout = argv.timeout;
|
||||
options.connectionOptions.user = argv.u || standardUser;
|
||||
options.generationOptions.activeRecord = argv.a;
|
||||
options.generationOptions.generateConstructor = argv.generateConstructor;
|
||||
@ -396,33 +382,6 @@ async function useInquirer(options: options): Promise<options> {
|
||||
type: "input"
|
||||
}
|
||||
])).output;
|
||||
|
||||
if (
|
||||
options.connectionOptions.databaseType === "mssql" ||
|
||||
options.connectionOptions.databaseType === "postgres"
|
||||
) {
|
||||
const { changeRequestTimeout } = await inquirer.prompt([
|
||||
{
|
||||
default: false,
|
||||
message: "Do you want to change default sql query timeout?",
|
||||
name: "changeRequestTimeout",
|
||||
type: "confirm"
|
||||
}
|
||||
]);
|
||||
if (changeRequestTimeout) {
|
||||
const { timeout } = await inquirer.prompt({
|
||||
message: "Query timeout(ms):",
|
||||
name: "timeout",
|
||||
type: "input",
|
||||
default: options.connectionOptions.timeout,
|
||||
validate(value) {
|
||||
const valid = !Number.isNaN(parseInt(value, 10));
|
||||
return valid || "Please enter a valid number";
|
||||
}
|
||||
});
|
||||
options.connectionOptions.timeout = parseInt(timeout, 10);
|
||||
}
|
||||
}
|
||||
const { customizeGeneration } = await inquirer.prompt([
|
||||
{
|
||||
default: false,
|
||||
|
@ -23,7 +23,7 @@ const { expect } = chai;
|
||||
it("Column default values", async () => {
|
||||
const testPartialPath = "test/integration/defaultValues";
|
||||
await runTestsFromPath(testPartialPath, true);
|
||||
}).timeout();
|
||||
})
|
||||
it("Platform specific types", async () => {
|
||||
const testPartialPath = "test/integration/entityTypes";
|
||||
await runTestsFromPath(testPartialPath, true);
|
||||
|
Loading…
Reference in New Issue
Block a user