This would probably end up in the Courts.

Assuming the ECJ concurs with the Advocate General, the decision to revoke an Article 50 notification must be done in Good Faith, and following proper constitutional processes. 

A country that revokes the article 50 notification only as a delaying tactic is not acting in Good Faith, and the ECJ could rule that it was a "stunt" and not recognize it. On the other hand, if proper constitutional processes are followed, it might be allowed. One can imagine the EU27 allowing for a delay of several months for a second referendum, especially if they believe that it will result in the UK remaining in the EU.

In the situation you describe: revoking and the re-invoking months later, it would be clear to the that the revocation was not done in good faith and was merely a delaying tactic and it would the be up to the EU27 whether to allow the UK further time to negotiate or require the UK to leave at short notice.