diff --git a/commafeed-client/src/app/types.ts b/commafeed-client/src/app/types.ts index c31b3254..a9f0ca8c 100644 --- a/commafeed-client/src/app/types.ts +++ b/commafeed-client/src/app/types.ts @@ -28,7 +28,7 @@ export interface ApplicationSettings { queryTimeout: number keepStatusDays: number maxFeedCapacity: number - maxCleanupBatchSize: number + databaseCleanupBatchSize: number refreshIntervalMinutes: number cache: ApplicationSettingsCache announcement?: string diff --git a/commafeed-server/config.dev.yml b/commafeed-server/config.dev.yml index 482a1b87..b631aaf6 100644 --- a/commafeed-server/config.dev.yml +++ b/commafeed-server/config.dev.yml @@ -27,7 +27,10 @@ app: # number of database updating threads databaseUpdateThreads: 1 - + + # rows to delete per query while cleaning up old entries + databaseCleanupBatchSize: 100 + # settings for sending emails (password recovery) smtpHost: localhost smtpPort: 25 @@ -67,9 +70,6 @@ app: # entries to keep per feed, old entries will be deleted, 0 to disable maxFeedCapacity: 500 - # rows to delete per query while cleaning up old entries, minimum 100 - maxCleanupBatchSize: 100 - # limit the number of feeds a user can subscribe to, 0 to disable maxFeedsPerUser: 0 diff --git a/commafeed-server/config.yml.example b/commafeed-server/config.yml.example index 298c02f7..e07e4a9c 100644 --- a/commafeed-server/config.yml.example +++ b/commafeed-server/config.yml.example @@ -28,6 +28,9 @@ app: # number of database updating threads databaseUpdateThreads: 1 + # rows to delete per query while cleaning up old entries + databaseCleanupBatchSize: 100 + # settings for sending emails (password recovery) smtpHost: smtpPort: diff --git a/commafeed-server/src/main/java/com/commafeed/CommaFeedConfiguration.java b/commafeed-server/src/main/java/com/commafeed/CommaFeedConfiguration.java index 6888bf34..bbab016f 100644 --- a/commafeed-server/src/main/java/com/commafeed/CommaFeedConfiguration.java +++ b/commafeed-server/src/main/java/com/commafeed/CommaFeedConfiguration.java @@ -7,6 +7,7 @@ import javax.validation.Valid; import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; import org.apache.commons.lang3.time.DateUtils; @@ -95,6 +96,11 @@ public class CommaFeedConfiguration extends Configuration { @Valid private Integer databaseUpdateThreads; + @NotNull + @Positive + @Valid + private Integer databaseCleanupBatchSize = 100; + private String smtpHost; private int smtpPort; private boolean smtpTls; @@ -135,11 +141,6 @@ public class CommaFeedConfiguration extends Configuration { @Valid private Integer maxFeedCapacity; - @NotNull - @Min(100) - @Valid - private Integer maxCleanupBatchSize; - @NotNull @Valid private Integer maxFeedsPerUser = 0; diff --git a/commafeed-server/src/main/java/com/commafeed/backend/service/DatabaseCleaningService.java b/commafeed-server/src/main/java/com/commafeed/backend/service/DatabaseCleaningService.java index 66d4c98d..9e58d4fc 100644 --- a/commafeed-server/src/main/java/com/commafeed/backend/service/DatabaseCleaningService.java +++ b/commafeed-server/src/main/java/com/commafeed/backend/service/DatabaseCleaningService.java @@ -41,7 +41,7 @@ public class DatabaseCleaningService { this.feedEntryDAO = feedEntryDAO; this.feedEntryContentDAO = feedEntryContentDAO; this.feedEntryStatusDAO = feedEntryStatusDAO; - this.batchSize = config.getApplicationSettings().getMaxCleanupBatchSize(); + this.batchSize = config.getApplicationSettings().getDatabaseCleanupBatchSize(); } public void cleanFeedsWithoutSubscriptions() { diff --git a/commafeed-server/src/test/resources/config.test.yml b/commafeed-server/src/test/resources/config.test.yml index 9eb58d44..e5cb3ce6 100644 --- a/commafeed-server/src/test/resources/config.test.yml +++ b/commafeed-server/src/test/resources/config.test.yml @@ -28,6 +28,9 @@ app: # number of database updating threads databaseUpdateThreads: 1 + # rows to delete per query while cleaning up old entries + databaseCleanupBatchSize: 100 + # settings for sending emails (password recovery) smtpHost: localhost smtpPort: 25 @@ -67,9 +70,6 @@ app: # entries to keep per feed, old entries will be deleted, 0 to disable maxFeedCapacity: 500 - # rows to delete per query while cleaning up old entries, minimum 100 - maxCleanupBatchSize: 100 - # limit the number of feeds a user can subscribe to, 0 to disable maxFeedsPerUser: 0