mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Delete filterlist entry if update has no sources
This commit is contained in:
parent
142bc1e54a
commit
1bf7946e58
1 changed files with 7 additions and 0 deletions
|
@ -197,6 +197,7 @@ func normalizeEntry(entry *listEntry) {
|
|||
func processEntry(ctx context.Context, filter *scopedBloom, entry *listEntry, records chan<- record.Record) error {
|
||||
normalizeEntry(entry)
|
||||
|
||||
// Only add the entry to the bloom filter if it has any sources.
|
||||
if len(entry.Sources) > 0 {
|
||||
filter.add(entry.Type, entry.Entity)
|
||||
}
|
||||
|
@ -208,6 +209,12 @@ func processEntry(ctx context.Context, filter *scopedBloom, entry *listEntry, re
|
|||
UpdatedAt: time.Now().Unix(),
|
||||
}
|
||||
|
||||
// If the entry is a "delete" update, actually delete it to save space.
|
||||
if len(entry.Sources) == 0 {
|
||||
r.CreateMeta()
|
||||
r.Meta().Delete()
|
||||
}
|
||||
|
||||
key := makeListCacheKey(strings.ToLower(r.Type), r.Value)
|
||||
r.SetKey(key)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue