(i) In all cases where a magistrate refuses to do any act relating to the duties of his or her office as magistrate, it shall be lawful for the party requiring the act to be done to apply to the High Court, upon an affidavit of the facts, for a rule calling upon the magistrate, and also upon the party to be affected by the act, to show cause why the act should not be done; and if, after due service of the rule, good cause is not shown against it, the High Court may make the same absolute, with or without or upon payment of costs, as it may seem just; and the said magistrate, upon being served with the rule absolute, shall obey the same and shall do the act required; and an action or other proceeding shall not be commenced or prosecuted against the magistrate for having obeyed the rule and done the act thereby required;