§ 24. Action to recover penalties or forfeitures. An action to recover a penalty or a forfeiture under this chapter or to enforce the powers of the commission may be brought in any court of competent jurisdiction in this state in the name of the people of the state of New York, and shall be commenced and prosecuted to final judgment by the commission. In any such action all penalties and forfeitures incurred up to the time of commencing the same may be sued for and recovered therein, and the commencement of an action to recover a penalty or forfeiture shall not be, or be held to be, a waiver of the right to recover any other penalty or forfeiture; if the defendant in such action shall prove that during any portion of the time for which it is sought to recover penalties or forfeitures for a violation of an order or regulation of the commission the defendant was actually and in good faith prosecuting a suit, action or proceeding in the courts to set aside such order or regulation, the court shall remit the penalties or forfeitures incurred during the pendency of such suit, action or proceeding. All moneys recovered in any such action, together with the costs thereof, shall be paid into the state treasury to the credit of the general fund. Any such action may be compromised or discontinued on application of the commission upon such terms as the court shall approve and order. An action may be maintained by the commission for the whole or any part of the penalties or forfeitures prescribed in this chapter, and judgment may be rendered for the amount demanded in the complaint, or for any less amount, as justice may require.