Campaign Cleanup

To keep the database small and performance we clean up the campaign related resources once it has reached an end-state.

  • Canceled campaigns

  • Launched campaigns where endedAt is at least one day in the past.

queue-cleanup-campaign-jobs cronjob

Once a day at 10:00 a script runs which queries the inapp-db for campaign which should be cleaned up. The found campaigns are put into the inapp-cleanup-campaign queue in AMQP.

cleanup-campaigns message-queue worker

Working from the inapp-cleanup-campaign queue the worker cleans up all resources belonging to the campaign specified in the message and once successfully done sets the cleanedUpAt timestamp of the campaign.

Cleaned up resources

So far the only resource which is being cleaned up is the audience of the campaign. On cleanup all contact-references belonging to the campaign are deleted from the campaign-contact-reference table.

The meta-data of the audience (audience-table) is kept around for debugging reasons since it does not contain much data.