lister_base: Split into chunks the tasks prior to creation
This should avoid the timeout-ing.
Trade off is that we create multiple transactions instead of one.
This will fix [1]
https://sentry.softwareheritage.org/share/issue/2858dec4b0794ee1a9029a080f6c7bb4/
Related to T2160
Test Plan
- tox
- prod: tested, the lister on the same task. It finished without any issue this time.
Migrated from D2477 (view on Phabricator)