One if the biggest questions I get asked is, "Should one confess to an affair that is over?" and generally, my answer would be no, unless the affair is suspected in some ways. If the affair is suspected, I think you're better off to offer voluntary confession. I think that kind of act is definitely more likely to get you points and you're more likely to then salvage a relationship if you express contrition, remorse, and if you express that sort of confession.
However, if this affair is over and has not been discovered or suspected, I think it's better to not confess it because of all the painful feelings it will bring up and also, because you have to ask yourself, "Why would I want to confess this affair? Is it because I want to alleviate my own feelings of guilt?" You wanna burden your partner with those feelings of guilt? So, the point is, is that if it's your own feelings that you're unable to handle, then you need to figure out how to process them yourself. No need to burden your partner with this. You have to figure out why this affair happened and why it would never happen again and I think no reason to then jeopardize your relationship before figuring all of this out.