mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	优化指标数据清理
This commit is contained in:
		@@ -481,6 +481,7 @@ func (this *MetricStatDAO) Clean(tx *dbs.Tx) error {
 | 
				
			|||||||
				_, err := this.Query(tx).
 | 
									_, err := this.Query(tx).
 | 
				
			||||||
					Attr("itemId", item.Id).
 | 
										Attr("itemId", item.Id).
 | 
				
			||||||
					Lte("createdDay", expiresDay).
 | 
										Lte("createdDay", expiresDay).
 | 
				
			||||||
 | 
										UseIndex("createdDay").
 | 
				
			||||||
					Limit(100_000). // 一次性不要删除太多,防止阻塞其他操作
 | 
										Limit(100_000). // 一次性不要删除太多,防止阻塞其他操作
 | 
				
			||||||
					Delete()
 | 
										Delete()
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -188,6 +188,7 @@ func (this *MetricSumStatDAO) Clean(tx *dbs.Tx) error {
 | 
				
			|||||||
					Attr("itemId", item.Id).
 | 
										Attr("itemId", item.Id).
 | 
				
			||||||
					Where("(createdDay IS NULL OR createdDay<:day)").
 | 
										Where("(createdDay IS NULL OR createdDay<:day)").
 | 
				
			||||||
					Param("day", expiresDay).
 | 
										Param("day", expiresDay).
 | 
				
			||||||
 | 
										UseIndex("createdDay").
 | 
				
			||||||
					Limit(100_000). // 一次性不要删除太多,防止阻塞其他操作
 | 
										Limit(100_000). // 一次性不要删除太多,防止阻塞其他操作
 | 
				
			||||||
					Delete()
 | 
										Delete()
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user