The process of offline package building has an incremental nature. Package never gets rebuilt from scratch, but rather updated with new data. This new data always comes within a context of offline delivery filters that represent a set of channels that should be included in the package.
directory-reach-detector together with directory-reach-extractor take care of keeping the package up-to-date. When new filters are added, they are processed by services and new set of subscribers is calculated (whether they should be included or excluded from the package). On the other hand, when filters are removed, our services just stop listening to any events related to subscribers from the segment that was removed. Because of this, the package will continue to include subscribers that should have been removed.
Considering the above, we should do the following when we need to rollback filters:
- remove filters from the database
from apps.subscribers.models import SubscribersDeliveryFilter
SubscribersDeliveryFilter.objects.filter(channel_id__in=channels).delete()- clean up the package
from apps.subscribers.models import SubscribersOfflinePackage
offline_package = SubscribersOfflinePackage.make()
offline_package.clean()- wait for the package to be rebuilt with a new data (look for directory-reach-extractor
OFFLINE_DETECTION_WINDOWsetting)