The ChannelBrokerState.clean_inactive_respondents/1 function is meant to cleanup the inactive respondents, yet it takes a list of active respondents and the :collect_garbage handler of the channel-broker load all active respondents, and we must always load all of them (e.g. we can't paginate).
The logic should be reversed. Loading only the list of inactive respondents would load less respondent ids and allow to do the cleanups in batches.
The
ChannelBrokerState.clean_inactive_respondents/1
function is meant to cleanup the inactive respondents, yet it takes a list of active respondents and the:collect_garbage
handler of the channel-broker load all active respondents, and we must always load all of them (e.g. we can't paginate).The logic should be reversed. Loading only the list of inactive respondents would load less respondent ids and allow to do the cleanups in batches.
See https://github.com/instedd/surveda/pull/2297#discussion_r1315162910