Use the failing relationship as a motivation for recovery...
That's what I did anyway, except my bf was gone, which opened my eyes to how negatively I had impacted our relationship, and made me determined to improve myself.
As luck or God would have it, we met up a year later and got back together instantly and he was very proud of my progress...
I know its hard to reframe and refocus when you feel so terrible, but negative emotions can be really good fuel if we choose to apply them.
So sorry you're struggling