docker-compose增加内存限制配置

This commit is contained in:
jianzhichu
2026-01-01 22:26:44 +08:00
parent 0532ef1006
commit 66718ff478
4 changed files with 182 additions and 75 deletions
@@ -3,7 +3,7 @@
<Project>
<PropertyGroup>
<_PublishTargetUrl>E:\code\dysync\bin\Release\net6.0\publish\</_PublishTargetUrl>
<History>True|2026-01-01T13:10:19.3664263Z||;True|2026-01-01T21:09:38.6071080+08:00||;True|2025-12-30T11:45:54.5543034+08:00||;True|2025-12-30T09:19:08.3178124+08:00||;True|2025-12-29T18:57:29.7032246+08:00||;True|2025-12-27T14:52:24.4780776+08:00||;False|2025-12-27T14:52:19.5635794+08:00||;True|2025-12-27T14:48:01.6252748+08:00||;False|2025-12-27T14:47:55.7976192+08:00||;True|2025-12-27T14:38:23.9723838+08:00||;True|2025-12-27T13:00:29.8583858+08:00||;True|2025-12-26T22:18:42.4015637+08:00||;True|2025-12-26T22:10:58.5274572+08:00||;True|2025-12-26T22:06:26.3129600+08:00||;True|2025-12-26T22:03:55.6718618+08:00||;False|2025-12-26T22:03:48.3809954+08:00||;True|2025-12-26T22:02:33.1840390+08:00||;True|2025-12-26T22:01:16.1660100+08:00||;True|2025-12-25T00:50:26.1116465+08:00||;True|2025-12-25T00:48:27.3087708+08:00||;True|2025-12-25T00:47:38.4835720+08:00||;</History>
<History>True|2026-01-01T14:16:10.2974067Z||;True|2026-01-01T22:16:06.2123787+08:00||;False|2026-01-01T22:15:33.3626979+08:00||;True|2026-01-01T22:01:30.7161900+08:00||;True|2026-01-01T21:10:19.3664263+08:00||;True|2026-01-01T21:09:38.6071080+08:00||;True|2025-12-30T11:45:54.5543034+08:00||;True|2025-12-30T09:19:08.3178124+08:00||;True|2025-12-29T18:57:29.7032246+08:00||;True|2025-12-27T14:52:24.4780776+08:00||;False|2025-12-27T14:52:19.5635794+08:00||;True|2025-12-27T14:48:01.6252748+08:00||;False|2025-12-27T14:47:55.7976192+08:00||;True|2025-12-27T14:38:23.9723838+08:00||;True|2025-12-27T13:00:29.8583858+08:00||;True|2025-12-26T22:18:42.4015637+08:00||;True|2025-12-26T22:10:58.5274572+08:00||;True|2025-12-26T22:06:26.3129600+08:00||;True|2025-12-26T22:03:55.6718618+08:00||;False|2025-12-26T22:03:48.3809954+08:00||;True|2025-12-26T22:02:33.1840390+08:00||;True|2025-12-26T22:01:16.1660100+08:00||;True|2025-12-25T00:50:26.1116465+08:00||;True|2025-12-25T00:48:27.3087708+08:00||;True|2025-12-25T00:47:38.4835720+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
+4
View File
@@ -151,6 +151,10 @@ services:
- 8.8.8.8 # Google DNS(提升海外访问稳定性)
- 114.114.114.114 # 国内DNS(提升国内访问稳定性)
- 223.5.5.5 # 阿里云DNS(备用)
deploy:
resources:
limits:
memory: 120m #限制内存占用不超过120mb,如果运行过程中报错,可以再增加点。不做限制会涨到300多
```
+73 -74
View File
@@ -157,20 +157,23 @@
<div v-if="currentTab === 'author'" key="author-view" class="stats-content">
<div class="authors-grid">
<div class="author-card" v-for="(author, index) in authors" :key="index">
<div class="author-avatar">
<img :src="author.icon" alt="作者头像" />
</div>
<div class="author-info">
<h3 class="author-name">{{ author.name }}</h3>
<p class="author-stats">作品数: {{ author.count }}</p>
<!-- 新增横向容器包裹头像和作者信息 -->
<div class="author-info-row">
<div class="author-avatar">
<img :src="author.icon" alt="作者头像" />
</div>
<div class="author-info">
<h3 class="author-name">{{ author.name }}</h3>
<p class="author-stats">同步数量: {{ author.count }}</p>
</div>
</div>
<!-- 进度条独立在横向容器下方不与头像同行 -->
<div class="author-progress">
<div class="progress-bar" :style="{ width: `${(author.count / totalVideos) * 100}%` }"></div>
</div>
</div>
</div>
</div>
<!-- 分类统计 -->
<div v-else key="category-view" class="stats-content">
<div class="categories-grid">
@@ -248,6 +251,16 @@ defineOptions({
name: 'StatsDashboard',
});
// 生成随机十六进制颜色的工具函数
const generateRandomColor = () => {
// 生成0-255的随机RGB值,转换为十六进制并补零
const randomHex = () =>
Math.floor(Math.random() * 256)
.toString(16)
.padStart(2, '0');
return `#${randomHex()}${randomHex()}${randomHex()}`;
};
// 加载数据和切换标签逻辑
onMounted(() => {
loadDashboardData();
@@ -268,27 +281,27 @@ const loadDashboardData = async () => {
totalAuthors.value = res.data.authorCount;
categoryTotal.value = res.data.categoryCount;
totalVideos.value = res.data.videoCount;
fileSizeTotal.value = res.data.videoSizeTotal || 0.0;
totalDiskSize.value = res.data.totalDiskSize || 0.0;
fileSizeTotal.value = res.data.videoSizeTotal || '0.00';
totalDiskSize.value = res.data.totalDiskSize || '0.00';
favoriteCount.value = res.data.favoriteCount;
collectCount.value = res.data.collectCount;
followCount.value = res.data.followCount || 0;
graphicVideoCount.value = res.data.graphicVideoCount || 0;
favoriteSize.value = res.data.videoFavoriteSize || 0.0;
collectSize.value = res.data.videoCollectSize || 0.0;
followSize.value = res.data.videoFollowSize || 0.0;
graphicVideoSize.value = res.data.graphicVideoSize || 0.0;
favoriteSize.value = res.data.videoFavoriteSize || '0.00';
collectSize.value = res.data.videoCollectSize || '0.00';
followSize.value = res.data.videoFollowSize || '0.00';
graphicVideoSize.value = res.data.graphicVideoSize || '0.00';
categories.value = res.data.categories;
authors.value = res.data.authors;
const cates = getRandomElements(categoriessss.value, categories.value.length);
const colors = getRandomElements(colorArray, categories.value.length);
categories.value.forEach((item, index) => {
item.icon = cates[index];
item.color = colors[index];
// 移除categoriessss相关逻辑,直接给分类设置固定图标cup(保证显示)
// 动态为每个分类生成随机颜色,替代原有的colorArray
categories.value.forEach((item) => {
item.icon = 'cup'; // 固定使用已定义的cup图标,确保显示正常
item.color = generateRandomColor(); // 随机生成颜色
});
} catch (err) {
console.error('加载仪表盘数据失败:', err);
@@ -300,46 +313,7 @@ const getRandomElements = (arr: any[], n: number) => {
if (n >= arr.length) return [...arr];
return [...arr].sort(() => Math.random() - 0.5).slice(0, n);
};
const categoriessss = ref<any[]>([
'cup',
'spoon',
'fork',
'knife',
'plate',
'bottle',
'toothbrush',
'comb',
'mirror',
'soap',
'mobile',
'tablet',
'camera',
'headphones',
'speaker',
'tv',
'watch',
'charger',
]);
const colorArray = [
'#3A7CA5',
'#D9A566',
'#6B4226',
'#829399',
'#A63446',
'#4F6367',
'#FE5F55',
'#C7EFCF',
'#78C0E0',
'#49BEAA',
'#49DCB1',
'#FF9999',
'#66B2FF',
'#99FF99',
];
</script>
<style scoped>
/* 基础样式 */
.stats-dashboard {
@@ -580,10 +554,9 @@ const colorArray = [
border: none;
color: #666666;
padding: 8px 16px;
border-radius: 20px;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
transition: all 0.3s ease;
transition: all 0.2s ease;
}
.tab-btn.active {
@@ -617,25 +590,28 @@ const colorArray = [
}
}
.author-card,
.category-card {
/* 作者卡片样式 - 核心修改:头像+文字横向,进度条独立在下 */
.author-card {
display: flex;
flex-direction: column; /* 整体纵向布局,容纳「头像+文字行」和「进度条行」 */
gap: 10px; /* 头像文字行 与 进度条 之间的间距,可微调 */
padding: 15px;
background: #eeeeee;
border-radius: 8px;
padding: 15px;
transition: transform 0.2s ease, box-shadow 0.2s ease;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.author-card {
display: flex;
flex-direction: column;
gap: 10px;
.author-card:hover {
transform: translateY(-3px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}
.author-card:hover,
.category-card:hover {
transform: translateX(5px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
/* 头像+文字 横向容器 */
.author-info-row {
display: flex;
align-items: center; /* 头像与文字垂直居中 */
gap: 12px; /* 头像与文字的间距,减少空白 */
}
.author-avatar {
@@ -643,6 +619,7 @@ const colorArray = [
height: 50px;
border-radius: 50%;
overflow: hidden;
flex-shrink: 0; /* 防止头像被压缩 */
}
.author-avatar img {
@@ -651,25 +628,36 @@ const colorArray = [
object-fit: cover;
}
/* 作者文字信息(名字+作品数) */
.author-info {
flex: 1; /* 占据头像右侧剩余空间 */
display: flex;
flex-direction: column; /* 名字在上,作品数在下,紧凑排列 */
gap: 3px; /* 名字与作品数的间距,减少空白 */
}
.author-name,
.category-name {
margin: 0 0 5px 0;
margin: 0; /* 移除默认外边距,消除多余空白 */
font-size: 16px;
color: #333333;
}
.author-stats,
.category-stats {
margin: 0;
font-size: 13px;
margin: 5px 0px; /* 移除默认外边距 */
font-size: 12px;
color: #666666;
line-height: 1; /* 紧凑行高,减少垂直空白 */
}
/* 进度条 - 独立成行,不与头像同行 */
.author-progress {
height: 6px;
background: #e0e0e0;
border-radius: 3px;
overflow: hidden;
width: 100%; /* 占满作者卡片宽度 */
}
.progress-bar {
@@ -679,10 +667,21 @@ const colorArray = [
transition: width 0.5s ease;
}
/* 分类卡片样式 */
.category-card {
display: flex;
align-items: center;
gap: 15px;
padding: 15px;
background: #eeeeee;
border-radius: 8px;
transition: transform 0.2s ease, box-shadow 0.2s ease;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.category-card:hover {
transform: translateY(-3px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}
.category-icon {
File diff suppressed because one or more lines are too long