mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 05:46:00 +00:00
chore(ci): release database after closed (#4819)
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase Backend Test / sqlite-test (20, false) (push) Waiting to run
NocoBase Backend Test / sqlite-test (20, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, true) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, false) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, true) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, false) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, true) (push) Waiting to run
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase Backend Test / sqlite-test (20, false) (push) Waiting to run
NocoBase Backend Test / sqlite-test (20, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, true) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, false) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, true) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, false) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, true) (push) Waiting to run
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
* chore(ci): release database after closed * chore: clean database * chore: test
This commit is contained in:
parent
88519c9c8f
commit
7084e8d35f
2
.github/workflows/nocobase-test-backend.yml
vendored
2
.github/workflows/nocobase-test-backend.yml
vendored
@ -111,7 +111,7 @@ jobs:
|
||||
DB_SCHEMA: ${{ matrix.schema }}
|
||||
COLLECTION_MANAGER_SCHEMA: ${{ matrix.collection_schema }}
|
||||
DB_TEST_DISTRIBUTOR_PORT: 23450
|
||||
DB_TEST_PREFIX: test_
|
||||
DB_TEST_PREFIX: test
|
||||
timeout-minutes: 60
|
||||
|
||||
mysql-test:
|
||||
|
@ -36,6 +36,11 @@ abstract class BaseClient<Client> {
|
||||
|
||||
await this._createDB(name);
|
||||
this.createdDBs.add(name);
|
||||
|
||||
// remove db after 3 minutes
|
||||
setTimeout(async () => {
|
||||
await this.removeDB(name);
|
||||
}, 3 * 60 * 1000);
|
||||
}
|
||||
|
||||
async releaseAll() {
|
||||
@ -51,6 +56,16 @@ abstract class BaseClient<Client> {
|
||||
this.createdDBs.delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
async removeDB(name: string) {
|
||||
if (!this._client) {
|
||||
return;
|
||||
}
|
||||
if (this.createdDBs.has(name)) {
|
||||
await this._removeDB(name);
|
||||
this.createdDBs.delete(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PostgresClient extends BaseClient<pg.Client> {
|
||||
@ -156,8 +171,9 @@ const server = http.createServer((req, res) => {
|
||||
res.end(JSON.stringify({ error }));
|
||||
});
|
||||
} else if (trimmedPath === 'release') {
|
||||
const name = parsedUrl.query.name as string | undefined;
|
||||
dbClient
|
||||
.releaseAll()
|
||||
.removeDB(name)
|
||||
.then(() => {
|
||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||
res.end();
|
||||
|
Loading…
Reference in New Issue
Block a user