mirror of
https://github.com/zoriya/flood.git
synced 2025-12-05 23:06:20 +00:00
fix: run compaction every interval (#834)
This commit is contained in:
@@ -31,6 +31,7 @@ class Users {
|
||||
});
|
||||
|
||||
db.ensureIndex({fieldName: 'username', unique: true});
|
||||
db.setAutocompactionInterval(config.dbCleanInterval);
|
||||
|
||||
return db;
|
||||
})();
|
||||
|
||||
@@ -21,6 +21,7 @@ class FeedService extends BaseService<Record<string, never>> {
|
||||
|
||||
constructor(...args: ConstructorParameters<typeof BaseService>) {
|
||||
super(...args);
|
||||
this.db.setAutocompactionInterval(config.dbCleanInterval);
|
||||
|
||||
this.onServicesUpdated = async () => {
|
||||
// Execute once only.
|
||||
|
||||
@@ -26,6 +26,7 @@ class NotificationService extends BaseService<NotificationServiceEvents> {
|
||||
|
||||
constructor(...args: ConstructorParameters<typeof BaseService>) {
|
||||
super(...args);
|
||||
this.db.setAutocompactionInterval(config.dbCleanInterval);
|
||||
|
||||
(async () => {
|
||||
const notifications = await this.db.findAsync<Notification>({}).catch(() => undefined);
|
||||
|
||||
@@ -21,6 +21,11 @@ class SettingService extends BaseService<SettingServiceEvents> {
|
||||
filename: path.join(config.dbPath, this.user._id, 'settings', 'settings.db'),
|
||||
});
|
||||
|
||||
constructor(...args: ConstructorParameters<typeof BaseService>) {
|
||||
super(...args);
|
||||
this.db.setAutocompactionInterval(config.dbCleanInterval);
|
||||
}
|
||||
|
||||
async destroy(drop: boolean) {
|
||||
if (drop) {
|
||||
await this.db.dropDatabaseAsync();
|
||||
|
||||
Reference in New Issue
Block a user