Fix bug in middleware/consume to change the worker state