From d572fc5452ae928f59aa0fb54dc4431f2d368323 Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Sun, 13 Nov 2022 12:21:15 +0000 Subject: [PATCH] moved 'store' filter processing after all other filters --- scraping.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scraping.go b/scraping.go index da58d7e..c84fa09 100644 --- a/scraping.go +++ b/scraping.go @@ -23,9 +23,16 @@ import ( func processFilters(filters []Filter, web *Web, watch *Watch, debug bool) { allFilters := filters processedMap := make(map[uint]bool, len(filters)) + + // collect 'store' filters so we can process them separately at the end + storeFilters := make([]Filter, 5) for len(filters) > 0 { filter := &filters[0] filters = filters[1:] + if filter.Type == "store" { + storeFilters = append(storeFilters, *filter) + continue + } var allParentsProcessed = true for _, parent := range filter.Parents { if _, contains := processedMap[parent.ID]; !contains && parent.Type != "cron" { @@ -40,6 +47,11 @@ func processFilters(filters []Filter, web *Web, watch *Watch, debug bool) { getFilterResult(allFilters, filter, watch, web, debug) processedMap[filter.ID] = true } + + // process the store filters last + for _, storeFilter := range storeFilters { + getFilterResult(allFilters, &storeFilter, watch, web, debug) + } } func getFilterResult(filters []Filter, filter *Filter, watch *Watch, web *Web, debug bool) {