mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-01-15 11:34:10 +08:00
perf: change db connect params (#11071)
This commit is contained in:
parent
69769e6203
commit
029e2210f5
5 changed files with 78 additions and 68 deletions
|
|
@ -71,8 +71,8 @@ func GetDBWithPath(dbPath string) (*gorm.DB, error) {
|
|||
if dbError != nil {
|
||||
return nil, dbError
|
||||
}
|
||||
sqlDB.SetMaxOpenConns(10)
|
||||
sqlDB.SetMaxIdleConns(5)
|
||||
sqlDB.SetMaxOpenConns(1)
|
||||
sqlDB.SetMaxIdleConns(1)
|
||||
sqlDB.SetConnMaxLifetime(time.Hour)
|
||||
return db, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,14 @@ func NewPSession(dbPath string) *PSession {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
sqlDB, dbError := db.DB()
|
||||
if dbError != nil {
|
||||
panic(err)
|
||||
}
|
||||
sqlDB.SetMaxOpenConns(1)
|
||||
sqlDB.SetMaxIdleConns(1)
|
||||
sqlDB.SetConnMaxLifetime(time.Hour)
|
||||
|
||||
store := gormstore.New(db, securecookie.GenerateRandomKey(32))
|
||||
return &PSession{
|
||||
Store: store,
|
||||
|
|
|
|||
|
|
@ -233,8 +233,8 @@ func newDB(pathItem string) (*gorm.DB, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sqlDB.SetMaxOpenConns(10)
|
||||
sqlDB.SetMaxIdleConns(5)
|
||||
sqlDB.SetMaxOpenConns(1)
|
||||
sqlDB.SetMaxIdleConns(1)
|
||||
sqlDB.SetConnMaxLifetime(time.Hour)
|
||||
return db, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ func GetDBWithPath(dbPath string) (*gorm.DB, error) {
|
|||
if dbError != nil {
|
||||
return nil, dbError
|
||||
}
|
||||
sqlDB.SetMaxOpenConns(10)
|
||||
sqlDB.SetMaxIdleConns(5)
|
||||
sqlDB.SetMaxOpenConns(1)
|
||||
sqlDB.SetMaxIdleConns(1)
|
||||
sqlDB.SetConnMaxLifetime(time.Hour)
|
||||
return db, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,71 +1,73 @@
|
|||
<template>
|
||||
<DrawerPro v-model="open" :header="$t('app.detail')" @close="handleClose" size="large">
|
||||
<div class="brief" v-loading="loadingApp">
|
||||
<div class="detail flex">
|
||||
<div class="w-12 h-12 rounded p-1 shadow-md icon">
|
||||
<img
|
||||
:src="getAppIconUrl(app.id, currentNode)"
|
||||
alt="App Icon"
|
||||
class="w-full h-full rounded"
|
||||
style="object-fit: contain"
|
||||
/>
|
||||
</div>
|
||||
<div class="ml-4">
|
||||
<div class="name mb-2">
|
||||
<span>{{ app.name }}</span>
|
||||
</div>
|
||||
<div class="description mb-4">
|
||||
<span>
|
||||
{{ app.description }}
|
||||
</span>
|
||||
</div>
|
||||
<br />
|
||||
<div v-if="!loadingDetail" class="mb-2">
|
||||
<el-alert
|
||||
v-if="!appDetail.enable"
|
||||
:title="$t('app.limitHelper')"
|
||||
type="warning"
|
||||
show-icon
|
||||
:closable="false"
|
||||
<template #content>
|
||||
<div class="brief" v-loading="loadingApp">
|
||||
<div class="detail flex">
|
||||
<div class="w-12 h-12 rounded p-1 shadow-md icon">
|
||||
<img
|
||||
:src="getAppIconUrl(app.id, currentNode)"
|
||||
alt="App Icon"
|
||||
class="w-full h-full rounded"
|
||||
style="object-fit: contain"
|
||||
/>
|
||||
</div>
|
||||
<el-button
|
||||
round
|
||||
v-if="appDetail.enable && operate === 'install'"
|
||||
@click="openInstall"
|
||||
type="primary"
|
||||
class="brief-button"
|
||||
>
|
||||
{{ $t('commons.button.install') }}
|
||||
</el-button>
|
||||
<div class="ml-4">
|
||||
<div class="name mb-2">
|
||||
<span>{{ app.name }}</span>
|
||||
</div>
|
||||
<div class="description mb-4">
|
||||
<span>
|
||||
{{ app.description }}
|
||||
</span>
|
||||
</div>
|
||||
<br />
|
||||
<div v-if="!loadingDetail" class="mb-2">
|
||||
<el-alert
|
||||
v-if="!appDetail.enable"
|
||||
:title="$t('app.limitHelper')"
|
||||
type="warning"
|
||||
show-icon
|
||||
:closable="false"
|
||||
/>
|
||||
</div>
|
||||
<el-button
|
||||
round
|
||||
v-if="appDetail.enable && operate === 'install'"
|
||||
@click="openInstall"
|
||||
type="primary"
|
||||
class="brief-button"
|
||||
>
|
||||
{{ $t('commons.button.install') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="descriptions">
|
||||
<el-descriptions border size="large" direction="vertical">
|
||||
<el-descriptions-item :label="$t('app.appOfficeWebsite')">
|
||||
<el-link @click="toLink(app.website)">
|
||||
{{ $t('app.link') }}
|
||||
<el-icon class="ml-1.5"><Promotion /></el-icon>
|
||||
</el-link>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('app.github')">
|
||||
<el-link @click="toLink(app.github)">
|
||||
{{ $t('app.link') }}
|
||||
<el-icon class="ml-1.5"><Promotion /></el-icon>
|
||||
</el-link>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('app.requireMemory')" v-if="appDetail.memoryRequired > 0">
|
||||
<span>{{ computeSizeFromMB(appDetail.memoryRequired) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('app.supportedArchitectures')" v-if="architectures.length > 0">
|
||||
<el-tag v-for="(arch, index) in architectures" :key="index" class="mx-1">
|
||||
{{ arch }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</div>
|
||||
<div class="descriptions">
|
||||
<el-descriptions border size="large" direction="vertical">
|
||||
<el-descriptions-item :label="$t('app.appOfficeWebsite')">
|
||||
<el-link @click="toLink(app.website)">
|
||||
{{ $t('app.link') }}
|
||||
<el-icon class="ml-1.5"><Promotion /></el-icon>
|
||||
</el-link>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('app.github')">
|
||||
<el-link @click="toLink(app.github)">
|
||||
{{ $t('app.link') }}
|
||||
<el-icon class="ml-1.5"><Promotion /></el-icon>
|
||||
</el-link>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('app.requireMemory')" v-if="appDetail.memoryRequired > 0">
|
||||
<span>{{ computeSizeFromMB(appDetail.memoryRequired) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('app.supportedArchitectures')" v-if="architectures.length > 0">
|
||||
<el-tag v-for="(arch, index) in architectures" :key="index" class="mx-1">
|
||||
{{ arch }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</div>
|
||||
<MdEditor previewOnly v-model="app.readMe" :theme="isDarkTheme ? 'dark' : 'light'" />
|
||||
<MdEditor previewOnly v-model="app.readMe" :theme="isDarkTheme ? 'dark' : 'light'" />
|
||||
</template>
|
||||
</DrawerPro>
|
||||
<Install ref="installRef" />
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue