Skip to content

Commit 634d7e8

Browse files
committed
refactor: Optimize connection pool #1256
1 parent 3b6a7f1 commit 634d7e8

6 files changed

Lines changed: 215 additions & 81 deletions

File tree

backend/apps/db/db.py

Lines changed: 182 additions & 75 deletions
Large diffs are not rendered by default.

frontend/src/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@
413413
"address": "Address",
414414
"low_version": "Compatible with lower versions",
415415
"ssl": "Enable SSL",
416-
"file_path": "File Path"
416+
"file_path": "File Path",
417+
"pool_size": "Connection Pool Size"
417418
},
418419
"sync_fields": "Sync Fields",
419420
"sync_fields_success": "Sync fields successfully",

frontend/src/i18n/ko-KR.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@
413413
"address": "주소",
414414
"low_version": "낮은 버전 호환",
415415
"ssl": "SSL 활성화",
416-
"file_path": "파일 경로"
416+
"file_path": "파일 경로",
417+
"pool_size": "연결 풀 크기"
417418
},
418419
"sync_fields": "동기화된 테이블 구조",
419420
"sync_fields_success": "테이블 구조 동기화 성공",

frontend/src/i18n/zh-CN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@
413413
"address": "地址",
414414
"low_version": "兼容低版本",
415415
"ssl": "启用 SSL",
416-
"file_path": "文件路径"
416+
"file_path": "文件路径",
417+
"pool_size": "连接池大小"
417418
},
418419
"sync_fields": "同步表结构",
419420
"sync_fields_success": "同步表结构成功",

frontend/src/i18n/zh-TW.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@
413413
"address": "位址",
414414
"low_version": "相容低版本",
415415
"ssl": "啟用 SSL",
416-
"file_path": "文件路徑"
416+
"file_path": "文件路徑",
417+
"pool_size": "連線池大小"
417418
},
418419
"sync_fields": "同步表結構",
419420
"sync_fields_success": "同步表結構成功",

frontend/src/views/ds/DatasourceForm.vue

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const form = ref<any>({
128128
timeout: 30,
129129
lowVersion: false,
130130
ssl: false,
131+
poolSize: 5,
131132
})
132133
133134
const close = () => {
@@ -177,6 +178,10 @@ const initForm = (item: any, editTable: boolean = false) => {
177178
: true
178179
form.value.ssl =
179180
configuration.ssl !== null && configuration.ssl !== undefined ? configuration.ssl : false
181+
form.value.poolSize =
182+
configuration.poolSize !== null && configuration.poolSize !== undefined
183+
? configuration.poolSize
184+
: 5
180185
}
181186
182187
if (editTable) {
@@ -250,6 +255,7 @@ const initForm = (item: any, editTable: boolean = false) => {
250255
timeout: 30,
251256
lowVersion: false,
252257
ssl: false,
258+
poolSize: 5,
253259
}
254260
}
255261
dialogVisible.value = true
@@ -339,6 +345,7 @@ const buildConf = () => {
339345
timeout: form.value.timeout,
340346
lowVersion: form.value.lowVersion,
341347
ssl: form.value.ssl,
348+
poolSize: form.value.poolSize,
342349
})
343350
)
344351
const obj = JSON.parse(JSON.stringify(form.value))
@@ -356,6 +363,7 @@ const buildConf = () => {
356363
delete obj.timeout
357364
delete obj.lowVersion
358365
delete obj.ssl
366+
delete obj.poolSize
359367
return obj
360368
}
361369
@@ -659,7 +667,9 @@ defineExpose({
659667
<el-input
660668
v-model="form.filename"
661669
clearable
662-
:placeholder="$t('datasource.please_enter') + $t('common.empty') + t('ds.form.file_path')"
670+
:placeholder="
671+
$t('datasource.please_enter') + $t('common.empty') + t('ds.form.file_path')
672+
"
663673
/>
664674
</el-form-item>
665675
</div>
@@ -735,7 +745,11 @@ defineExpose({
735745
>
736746
<el-checkbox v-model="form.lowVersion" :label="t('ds.form.low_version')" />
737747
</el-form-item>
738-
<el-form-item v-if="form.type === 'mysql' || form.type === 'doris'" :label="t('ds.form.ssl')" prop="ssl">
748+
<el-form-item
749+
v-if="form.type === 'mysql' || form.type === 'doris'"
750+
:label="t('ds.form.ssl')"
751+
prop="ssl"
752+
>
739753
<el-switch v-model="form.ssl" />
740754
</el-form-item>
741755
<el-form-item v-if="form.type !== 'es'" :label="t('ds.form.extra_jdbc')">
@@ -781,6 +795,15 @@ defineExpose({
781795
controls-position="right"
782796
/>
783797
</el-form-item>
798+
<el-form-item v-if="form.type !== 'es'" :label="t('ds.form.pool_size')" prop="poolSize">
799+
<el-input-number
800+
v-model="form.poolSize"
801+
clearable
802+
:min="1"
803+
:max="500"
804+
controls-position="right"
805+
/>
806+
</el-form-item>
784807
</div>
785808
</el-form>
786809
<div

0 commit comments

Comments
 (0)