enhance(server): delete outdated notes of antenna regularly to improve db performance
This commit is contained in:
		
							parent
							
								
									ad4d8b07d3
								
							
						
					
					
						commit
						a9a245b461
					
				
					 2 changed files with 9 additions and 1 deletions
				
			
		|  | @ -27,6 +27,7 @@ You should also include the user name that made the change. | ||||||
| - Server: improve note scoring for featured notes @CyberRex0 | - Server: improve note scoring for featured notes @CyberRex0 | ||||||
| - Server: delete outdated notifications regularly to improve db performance @syuilo | - Server: delete outdated notifications regularly to improve db performance @syuilo | ||||||
| - Server: delete outdated hard-mutes regularly to improve db performance @syuilo | - Server: delete outdated hard-mutes regularly to improve db performance @syuilo | ||||||
|  | - Server: delete outdated notes of antenna regularly to improve db performance @syuilo | ||||||
| - Client: use tabler-icons instead of fontawesome to better design @syuilo | - Client: use tabler-icons instead of fontawesome to better design @syuilo | ||||||
| - Client: Add new gabber kick sounds (thanks for noizenecio) | - Client: Add new gabber kick sounds (thanks for noizenecio) | ||||||
| - Client: Compress non-animated PNG files @saschanaz | - Client: Compress non-animated PNG files @saschanaz | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import { Inject, Injectable } from '@nestjs/common'; | import { Inject, Injectable } from '@nestjs/common'; | ||||||
| import { In, LessThan, MoreThan } from 'typeorm'; | import { In, LessThan, MoreThan } from 'typeorm'; | ||||||
| import { DI } from '@/di-symbols.js'; | import { DI } from '@/di-symbols.js'; | ||||||
| import type { MutedNotesRepository, NotificationsRepository, UserIpsRepository } from '@/models/index.js'; | import type { AntennaNotesRepository, MutedNotesRepository, NotificationsRepository, UserIpsRepository } from '@/models/index.js'; | ||||||
| import type { Config } from '@/config.js'; | import type { Config } from '@/config.js'; | ||||||
| import type Logger from '@/logger.js'; | import type Logger from '@/logger.js'; | ||||||
| import { bindThis } from '@/decorators.js'; | import { bindThis } from '@/decorators.js'; | ||||||
|  | @ -26,6 +26,9 @@ export class CleanProcessorService { | ||||||
| 		@Inject(DI.mutedNotesRepository) | 		@Inject(DI.mutedNotesRepository) | ||||||
| 		private mutedNotesRepository: MutedNotesRepository, | 		private mutedNotesRepository: MutedNotesRepository, | ||||||
| 
 | 
 | ||||||
|  | 		@Inject(DI.antennaNotesRepository) | ||||||
|  | 		private antennaNotesRepository: AntennaNotesRepository, | ||||||
|  | 
 | ||||||
| 		private queueLoggerService: QueueLoggerService, | 		private queueLoggerService: QueueLoggerService, | ||||||
| 		private idService: IdService, | 		private idService: IdService, | ||||||
| 	) { | 	) { | ||||||
|  | @ -49,6 +52,10 @@ export class CleanProcessorService { | ||||||
| 			reason: 'word', | 			reason: 'word', | ||||||
| 		}); | 		}); | ||||||
| 
 | 
 | ||||||
|  | 		this.antennaNotesRepository.delete({ | ||||||
|  | 			id: LessThan(this.idService.genId(new Date(Date.now() - (1000 * 60 * 60 * 24 * 90)))), | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
| 		this.logger.succ('Cleaned.'); | 		this.logger.succ('Cleaned.'); | ||||||
| 		done(); | 		done(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue