Skip to content

Commit

Permalink
Avoid duplicate feeds fetching run
Browse files Browse the repository at this point in the history
  • Loading branch information
goulven authored and goulven committed Oct 3, 2024
1 parent 4810c5e commit b91852b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.commons.lang3.StringUtils;
import org.open4goods.commons.config.yml.datasource.DataSourceProperties;
Expand Down Expand Up @@ -46,7 +47,6 @@ public class FeedService {
private DataSourceConfigService datasourceConfigService;
private Map<String, FeedConfiguration> feedConfigs;


public FeedService(SerialisationService serialisationService, DataSourceConfigService datasourceConfigService, CsvDatasourceFetchingService fetchingService, Map<String, FeedConfiguration> feedConfigs) {
super();
this.feedConfigs = feedConfigs;
Expand All @@ -61,6 +61,12 @@ public FeedService(SerialisationService serialisationService, DataSourceConfigSe
*/
@Scheduled(cron = "0 0 20,8 * * ?")
public void fetchFeeds() {

if (fetchingService.getQueue().size() > 0) {
logger.warn("Fetching feeds skipped, it is already running");
return;
}

logger.info("Fetching CSV affiliation feeds");
// 1 - Loads the whole feeds as a list of DataSourceProperties, eventually hot defaulted

Expand Down

0 comments on commit b91852b

Please sign in to comment.