Running all tests fails
Like this job.
This is because some previous tests post tasks in the queue but never execute them (because it is not needed for the test). But as the tasks
on Transaction
is global per thread, they stay for the next test transaction.
This is not a problem in production because we have the design of one thread per request and we always run tasks at the end of the request. But when running tests, they are all executed in the same thread, so we must clear the tasks
at the end of each transaction.