In an action upon an official bond, if judgments have been recovered against the surety therein other than by confession, equal in the aggregate to the penalty or any part thereof of such bond, and if such recovery be established on the trial, judgment shall not be given against such surety for an amount exceeding such penalty, or such portion thereof as is not already recovered against him or her.