When they finish their daily work their needs are very high. They are hungry, tired, and they all are looking forward to a shower.
Due to this, it is not strange they riot just after their work.
The best way to avoid this is to make them feel as comfortable as possible by upgrading cells, the exercise yard, the meals...
This could be hard especially when the weekly event starts, but the more you play the event, the better upgrades you will be able to unlock, and the happier they will be.
There is also another thing you must consider. Having enough guards will help you stop the riots quickly if they finally happen.