Optimize rake task resetting all lightweight flags