Skip to content

Commit

Permalink
Added auto_clear_notifications feature control flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sebpet182 committed Aug 25, 2024
1 parent a5564b8 commit 3cb7be0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 36 deletions.
33 changes: 0 additions & 33 deletions DEV_MODE.ini

This file was deleted.

7 changes: 7 additions & 0 deletions src/main/java/spotify/bot/properties/FeatureControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class FeatureControl {
@Value("${spotify.discovery.crawl.feature.auto_purger:#{true}}")
private boolean enableAutoPurger;

@Value("${spotify.discovery.crawl.feature.auto_clear_notifications:#{true}}")
private boolean autoClearNotifications;

private final DiscoveryBotLogger logger;

FeatureControl(DiscoveryBotLogger logger) {
Expand Down Expand Up @@ -93,4 +96,8 @@ public boolean isForwarderEnabled() {
public boolean isAutoPurgeEnabled() {
return enableAutoPurger;
}

public boolean isAutoClearNotifications() {
return autoClearNotifications;
}
}
2 changes: 1 addition & 1 deletion src/main/java/spotify/bot/service/CachedArtistService.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public CachedArtistsContainer getFollowedArtistsIds() throws SQLException, Illeg
List<Artist> newFollowedArtists = followedArtist.stream()
.filter(a -> !cachedArtists.contains(a.getId()))
.collect(Collectors.toList());
List<String> newFollowedArtistsIds = followedArtist.stream()
List<String> newFollowedArtistsIds = newFollowedArtists.stream()
.map(Artist::getId)
.collect(Collectors.toList());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public List<AlbumSimplified> getAllAlbumsOfArtists(List<String> followedArtists,
results.addAll(albumIdsOfSingleArtist);
if (showProgress) {
done++;
log.info(done + " / " + followedArtists.size());
log.debug(done + " / " + followedArtists.size());
}
}
return results;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/spotify/controller/MiscController.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class MiscController implements SchedulingConfigurer {

@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
if (featureControl.isPlaylistMetaEnabled()) {
if (featureControl.isAutoClearNotifications() && featureControl.isPlaylistMetaEnabled()) {
taskRegistrar.addFixedDelayTask(this::clearNewIndicatorScheduler, CLEAR_NOTIFIERS_INTERVAL);
}
}
Expand Down
1 change: 1 addition & 0 deletions templates/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
#spotify.discovery.crawl.feature.initial_crawl = false
#spotify.discovery.crawl.feature.forwarder = false
#spotify.discovery.crawl.feature.auto_purger = false
#spotify.discovery.crawl.feature.auto_clear_notifications = false

0 comments on commit 3cb7be0

Please sign in to comment.