org.nuxeo.lib.stream.computation.StreamProcessor#drainAndStop is used to terminate processors after trying to process remaining records in the stream.
This is used in many unit tests and now in the repair Works operation
This method takes a timeout parameter but incorrectly.
The drain will stop before the timeout and while there are still records to process if the processing of a record or timer takes more than 1 second.
This is a possible cause of random UT failures on loaded CI slaves.
Also, for the WorkManager repair procedure, it requires to executed many times the operation to process all Works in failure.